Skip to content

Instantly share code, notes, and snippets.

Harry Huang hyharryhuang

Block or report user

Report or block hyharryhuang

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
View SourceShell.sh
#!/bin/sh
#Runs from the existing shell (instead of creating a new copy), meaning any env variable changes will persist.
source ./myscript.sh
#OR using the . shortcut:
. ./myscript.sh
@hyharryhuang
hyharryhuang / mapFilterReduce.js
Created Jan 22, 2015
Javascript Map, Filter, Reduce Usage
View mapFilterReduce.js
var a = [1,2,3,4,5];
//MAP
var mapped = a.map(function(number) {
return number * 2;
});
console.log(mapped);
//FILTER
@hyharryhuang
hyharryhuang / IterateExample.js
Created Jan 12, 2015
Iterate through javascript Objects
View IterateExample.js
for (var key in p) {
if (p.hasOwnProperty(key)) { //make sure key is part of this object, not coming from a prototype.
alert(key + " -> " + p[key]);
}
}
@hyharryhuang
hyharryhuang / ScriptTagAvoidProblems.htm
Created Jan 1, 2015
Avoiding problems with embedded < in scripts
View ScriptTagAvoidProblems.htm
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
View restartGhost.sh
sudo service nginx restart
sudo service ghost restart
@hyharryhuang
hyharryhuang / startPython.sh
Last active Aug 29, 2015
Easy Kill and Rerun Python Wrapper
View startPython.sh
STARTSCRIPT="run.py"
echo "Running script..."
sudo pkill -f $STARTSCRIPT
sudo python $STARTSCRIPT &
You can’t perform that action at this time.