Skip to content

Instantly share code, notes, and snippets.

@hiun
hiun / omega.js
Created June 27, 2017 18:37 — forked from CrossEye/omega.js
Functional compostion using fake operator overloading
// Based on a discussion with Michael Haufe:
// https://groups.google.com/group/jsmentors/browse_thread/thread/d028fb0041f93a27
// Not really recommended for anything but the fun of knowing it can be done!
var omega = function() {
var queue = [];
var valueOf = Function.prototype.valueOf;
Function.prototype.valueOf = function() {
queue.push(this);
return 1; // not needed now, but could be used later to distinguish operators.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
/*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each
@hiun
hiun / proc.js
Created September 20, 2015 06:23
Multiple Request with Promise
var request = require('request');
Promise.resolve(request(args1, arg2, arg3)).then(function (response, html) { //no error arg here!
//parsing with cheerio
return request(newArg1);
}).then(function () {
//parsing multiple article
return [
request(newArg2),
request(newArg3),
@hiun
hiun / ps1.sh
Last active August 29, 2015 14:19
PS1="\[\e]2;$PWD\[\a\]\[\e]1;\]$(basename "$(dirname "$PWD")")/\W\[\a\]${BOLD}\$(usernamehost)\[$GREEN\]\w\$(git_info)\[$WHITE\]\n\$ \[$RESET\]"
'use strict';
(function () {
var i;
var obj = {};
for (i = 0; i < 200; i++) {
var arr = [
'red',
'orange',
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hiun
hiun / zmqReqRepExample.js
Last active August 29, 2015 14:05
Super Simple ZeroMQ request - reply example
//Please run in separated file - requester.js AND replier.js.
//requester.js
var zmq = require('zmq')
, sock = zmq.socket('req');
sock.connect('tcp://127.0.0.1:3000');
console.log('Requester bound to port 3000');
//Copy this code to specific folder
//Name the file to app.js
//Run fillowing command to install dependent modules and run application
//npm install express && node app.js
var express = require('express');
var app = express();
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@hiun
hiun / helloworld.bin
Created July 19, 2014 10:57
Hello World in Binary (Generated from Assembly language by GCC Assembler / Binary dump by xxd with -b option)
h0000000: 01111111 01000101 01001100 01000110 00000010 00000001 .ELF..
0000006: 00000001 00000000 00000000 00000000 00000000 00000000 ......
000000c: 00000000 00000000 00000000 00000000 00000010 00000000 ......
0000012: 00111110 00000000 00000001 00000000 00000000 00000000 >.....
0000018: 01000000 00000100 01000000 00000000 00000000 00000000 @.@...
000001e: 00000000 00000000 01000000 00000000 00000000 00000000 ..@...
0000024: 00000000 00000000 00000000 00000000 01110000 00010001 ....p.
000002a: 00000000 00000000 00000000 00000000 00000000 00000000 ......
0000030: 00000000 00000000 00000000 00000000 01000000 00000000 ....@.
0000036: 00111000 00000000 00001001 00000000 01000000 00000000 8...@.