Skip to content

Instantly share code, notes, and snippets.

💭
Researching Server-side Rendering Framework Stuff

Thanik Bhongbhibhat bhongy

💭
Researching Server-side Rendering Framework Stuff
Block or report user

Report or block bhongy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bhongy
bhongy / node-proxy-server.js
Created Aug 7, 2018
[nodejs] A simple example how to write a proxy server piping server request to client request / client response back to server response.
View node-proxy-server.js
// from: http://book.mixu.net/node/ch10.html
'use strict';
const http = require('http');
const url = require('url');
const server = http.createServer((sreq, sres) => {
const { pathname } = url.parse(sreq.url);
const opts = {
@bhongy
bhongy / node-fs-write-from-stdin.js
Last active Aug 4, 2018
[nodejs] A simple example how to write to a file from stdin using stream.
View node-fs-write-from-stdin.js
// from: http://book.mixu.net/node/ch9.html
'use strict';
const fs = require('fs');
const file = fs.createWriteStream('./output.txt');
process.stdin.pipe(file);
// stdin is paused by default
@bhongy
bhongy / unconditional-stack.js
Created Jul 12, 2018
Anti-if Stack Implementation
View unconditional-stack.js
// idea from: https://www.youtube.com/watch?v=APUCMSPiNh4
class IllegalStateError extends Error {
constructor(...args) {
super(...args);
}
}
class Empty {
size() {
View slack_theme_dark_zenburn
#333333,#1E2320,#709080,#FFFFFF,#1E2320,#FFFFFF,#F0DFAF,#CC9393
// https://slackthemes.net/#/dark_zenburn
@bhongy
bhongy / es6-recursive-flatten.js
Created Feb 1, 2018
Simple Recursive Flatten Function in ES6
View es6-recursive-flatten.js
const flatten = xs => Array.isArray(xs)
? [].concat(...xs.map(flatten))
: xs;
@bhongy
bhongy / vscode__settings.json__flow
Created Jan 5, 2018
VSCode Workspace Settings for Flow Projects
View vscode__settings.json__flow
{
// from: https://gist.github.com/bhongy/3817b9b8fad85096039df78e339deae4
/*
Suggested VSCode Extensions
- mgmcdermott.vscode-language-babel
- dbaeumer.vscode-eslint
- flowtype.flow-for-vscode
- esbenp.prettier-vscode
View sequential-touch.css
.wrapper {
height: 100vh;
width: 100vw;
background-color: green;
}
@bhongy
bhongy / partial-function-application.js
Last active Aug 29, 2015
JS: Partial Function Application
View partial-function-application.js
function partial(func /*, 0..n args */) {
var args = Array.prototype.slice.call(arguments, 1); // save all additional arguments to args (except index 0: func)
return function() {
var allArguments = args.concat(Array.prototype.slice.call(arguments)); // then add arguments from the original function declaration
return func.apply(this, allArguments);
};
}
// See: http://stackoverflow.com/questions/373157/how-can-i-pass-a-reference-to-a-function-with-parameters
@bhongy
bhongy / .bash_profile
Last active Aug 29, 2015
.bash_profile
View .bash_profile
source ~/.profile
# === SSH Agent from Atlassian - https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
View CSS: Modern Image Replacement 2014
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
/* Scott Kellum Technique - Reference: http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/ */
Use this for SEO/Accessability Friendly
You can’t perform that action at this time.