Skip to content

Instantly share code, notes, and snippets.

View sairion's full-sized avatar
⚛️

Jaeho Lee (Jay) sairion

⚛️
View GitHub Profile
#http://ruby-hacking-guide.github.io/minimum.html
@sairion
sairion / nix rel res.md
Last active December 24, 2015 13:19
Linux / Unix related resources
@sairion
sairion / linux shell a primer.sh
Created October 6, 2013 02:53
linux shell a primer.sh
-hashbangs:
shell annotation that defines what to excute or compile, located at top.
example: #!/bin/bash
-Shell builtin commands. ($ man builtin)
- do done loop
do
case $opt in
"opt 1"
@sairion
sairion / Regexp primer.js
Created October 6, 2013 03:08
Regexp : Regular Expression
/*#Regexp syntax:
/ match / options /
^ ^
start of match: ^
end of match: $
wrap: ( )
range: [0-9] = \d
[01] = 0 or 1
@sairion
sairion / Slice URL and get param values via JavaScript.js
Last active May 22, 2018 06:41
Slice URL and get param values via JavaScript
//using String.split to split and assign Object
function splitCurrentURL(){
//query given index.html?this=true&that=good;
var url = location.href.split("?")[1]; // this=true&that=good;
params = {}; //init param obj
url = url.split("&"); // ['this=true','that=good']
for(var i = 0; i<url.length; i++){
var split_cache = url[i].split("="); // ['this','true'], ...
@sairion
sairion / reverseString.js
Created October 26, 2013 02:51
reverseString.js
function reverseString(string){
var length = string.length;
var output = '';
for(var i=1;i<=length;i++){
output = output.concat(string[length-i]);
console.dir(output)
}
return output;
@sairion
sairion / Awkwardness of JavaScript.js
Created October 26, 2013 03:47
Awkwardness of JavaScript.js
function add(a,b){ return a + b;}
add(1) //returns NaN
@sairion
sairion / handling javascript string.js
Created October 27, 2013 04:23
How to handle JavaScript string
//extract substring from a string.
String.prototype.substring([starting index], [end index])
//strip string before the index
String.prototype.substring([index])
//get index of string, if search doesn't exist in string then return -1
String.prototype.indexOf([search])
@sairion
sairion / Data Structures.md
Created October 27, 2013 08:05
Data Structures

Popular Structures

List

Linked List: Linked list is a dynamic data structure whose length can be increased or decreased at run time.

How Linked lists are different from arrays? Consider the following points :

An array is a static data structure. This means the length of array cannot be altered at run time. While, a linked list is a dynamic data structure. In an array, all the elements are kept at consecutive memory locations while in a linked list the elements (or nodes) may be kept at any location but still connected to each other.

@sairion
sairion / How to handle Javascript Array.js
Created October 27, 2013 13:26
How to handle Javascript Array
//convert array-like object into array:
//ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments
//local variable 'arguments' can be converted into array using Array.prototype.slice.call(arguments)
function getArrayofArgs(){
var args = Array.prototype.slice.call(arguments)
return args;
}