Skip to content

Instantly share code, notes, and snippets.

View gkoo's full-sized avatar
💭
Pushing down the buttons on the keyboard

Gordon Koo gkoo

💭
Pushing down the buttons on the keyboard
View GitHub Profile
@gkoo
gkoo / fruition.js
Created August 30, 2024 23:56
fruition
/* CONFIGURATION STARTS HERE */
/* Step 1: enter your domain name like fruitionsite.com */
const MY_DOMAIN = "example.org"
/*
* Step 2: enter your URL slug to page ID mapping
* The key on the left is the slug (without the slash)
* The value on the right is the Notion page ID
*/
@gkoo
gkoo / index.js
Created June 9, 2020 19:47
Two-way communication from the server side
const express = require('express');
const http = require('http');
const port = 5000;
const app = express();
const server = http.Server(app);
const io = require('socket.io')(server);
io.on('connection', socket => {
console.log('New client connected');
@gkoo
gkoo / App.js
Last active June 9, 2020 19:51
Two-way communication from client side
import React, { useEffect, useState } from 'react';
import socketIOClient from 'socket.io-client';
import logo from './logo.svg';
import './App.css';
function App() {
const [socket, setSocket] = useState(null);
useEffect(() => {
setSocket(socketIOClient('http://localhost:5000'));
let count = 0;
setInterval(() => io.sockets.emit(`Hello ${++count}`), 1000);
@gkoo
gkoo / App.js
Created June 9, 2020 19:21
code example for word game blog post
import React, { useEffect, useState } from 'react';
import socketIOClient from 'socket.io-client';
import logo from './logo.svg';
import './App.css';
function App() {
const [socket, setSocket] = useState(null);
useEffect(() => {
setSocket(socketIOClient('http://localhost:5000'));
@gkoo
gkoo / index.js
Last active June 9, 2020 19:19
code example for word game blog post
const express = require('express');
const http = require('http');
const port = 5000;
const app = express();
const server = http.createServer(app);
const io = require('socket.io')(server);
io.on('connection', socket => {
console.log('New client connected');
@gkoo
gkoo / ruby.txt
Created April 26, 2016 21:22
Ruby is a dynamic language
Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
Ruby is a dynamic, open source programming
language with a focus on simplicity and
productivity. It has an elegant syntax that is
natural to read and easy to write.
@gkoo
gkoo / wishlists.txt
Created February 22, 2016 22:24
wishlists
U1,Amsterdam,Barcelona,London,Prague
U2,Shanghai,Hong Kong,Moscow,Sydney,Melbourne
U3,London,Boston,Amsterdam,Madrid
U4,Barcelona,Prague,London,Sydney,Moscow
Amsterdam,Barcelona,London,Prague
{
"encrypted_user_id": "1xg8iTAXcUQRdmt0PMA9LjVexYj16gsOkXe9tB6SUTuDDTKcdOju4sp2K8Iz3Csu",
"requirement": "all",
"groups": {
"basic": {
"type": "all",
"items": [
{
"id": "confirmed_email",
"status": "default",
@gkoo
gkoo / gist:6357095
Last active December 21, 2015 19:49
Steps for getting set up with Prat (stevetan version)