This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//remove old unused containers | |
docker rm -f $(docker ps -a -q) | |
// remove untagged images | |
docker rmi $(docker images | grep "^<none>" | awk '{print $3}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: \d+:0;(gd|gst|gaa|ga|gc|irb|git reset|git stash|newzsh|glg|gb|git push|git init|grm|gl|mc|top|git rebase|ember|rake|rackup|git rm|sensors|rails s|tree|ls|ember install|rubocop|reboot|pry|gitg|gitk|man|unity|bower install|npm install|bundle install|bundle update|git pull|node|jekyll|kill|bin\/console|tmux|la|cd ~/code|nvm|fm|ruby).*\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cmd": ["babel-node", "$file"], | |
"selector": "source.js", | |
"path": "/usr/local/bin:$PATH", // ENV setting for mac users | |
"quiet": true // get rid of annoying `[Finished in %fs]` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"values": [ | |
{ | |
"country": "Albania", | |
"length": "28", | |
"code": "AL", | |
"format": "AL2!n8!n16!c" | |
}, | |
{ | |
"country": "Andorra", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import json | |
csvfile = open('test.csv', 'r') | |
jsonfile = open('file.json', 'w') | |
def lookahead(iterable): | |
"""Pass through all values from the given iterable, augmented by the | |
information if there are more values to come after the current one | |
(True), or if it is the last value (False). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dateDiffInMillis = (date1, date2) => | |
Math.abs(date2.getTime() - date1.getTime()); | |
const dayDifferenceInSeconds = (date1, date2) => | |
Math.round(dateDiffInMillis(date1, date2) / 1000); | |
const minuteDifferenceBetweenDates = (date1, date2) => | |
Math.round(dayDifferenceInSeconds(date1, date2) / 60); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long startTime = System.nanoTime(); | |
method(); | |
long stopTime = System.nanoTime(); | |
long millis = stopTime - startTime; | |
public String getDurationFormattedString(long startTime, long stopTime) { | |
final long nanosDifference = stopTime - startTime; | |
return String.format("%02d min, %02d sec %02d millis", | |
TimeUnit.NANOSECONDS.toMinutes(nanosDifference), | |
TimeUnit.NANOSECONDS.toSeconds(nanosDifference) - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function output(inp) { | |
document.body.appendChild(document.createElement('pre')).innerHTML = inp; | |
} | |
function syntaxHighlight(json) { | |
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); | |
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { | |
var cls = 'number'; | |
if (/^"/.test(match)) { | |
if (/:$/.test(match)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+String.prototype.format = function (placeholders) { | |
+ var s = this; | |
+ for (var propertyName in placeholders) { | |
+ var re = new RegExp('{' + propertyName + '}', 'gm'); | |
+ s = s.replace(re, placeholders[propertyName]); | |
+ } | |
+ return s; | |
+}; | |
console.log("Hi my name is ${name} and i'm {$age} years old".format({name: "Andrew", age: "30"})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pandoc intro/index.md object/general.md object/prototype.md object/hasownproperty.md object/forinloop.md function/general.md function/this.md function/closures.md function/arguments.md function/constructors.md function/scopes.md array/general.md array/constructor.md types/equality.md types/typeof.md types/instanceof.md types/casting.md core/eval.md core/undefined.md core/semicolon.md core/delete.md other/timeouts.md -o Javascript-Garden.epub |