This file contains hidden or 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 post = (url, body) => fetch(url, { | |
| headers: { | |
| 'Accept': 'application/json', | |
| 'Content-Type': 'application/json' | |
| }, | |
| method: "POST", | |
| body: JSON.stringify(body) | |
| }); |
This file contains hidden or 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
| document.querySelector("button[title='Expand Player']").style.display = "none" |
This file contains hidden or 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
| curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash | |
| source ~/.bashrc | |
| nvm install stable | |
| npm install rx request |
This file contains hidden or 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
| echo "Downloading tab completion to ~/.tab_completion_git" | |
| curl -s "https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash" > ~/.tab_completion_git | |
| echo "Downloading bash prompt to ~/.bash_prompt" | |
| curl -s "https://gist.githubusercontent.com/alanmquach/31d9088cf7f4126c59d1/raw/5ce769a35513a98997e5dda32b259e9ac3ece0a1/.bash_prompt" > ~/.bash_prompt | |
| echo "Adding .tab_completion_git, .bash_prompt to .bash_profile" | |
| echo 'for file in ~/.{tab_completion_git,bash_prompt}; do [ -r "$file" ] && [ -f "$file" ] && source "$file"; done' >> ~/.bash_profile | |
| echo 'export BASH_PROFILE_SOURCED=true' >> ~/.bash_profile |
This file contains hidden or 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
| // Pyramid of doom | |
| function go(input) { | |
| // step 1 | |
| doSomethingAsync(input, function (result) { | |
| // step 2 | |
| doSomethingElse(result, function (result2) { | |
| // step 3 | |
| doYetAnotherThing(result2, function (result3) { | |
| moveOnWithLife(result3); | |
| }); |
This file contains hidden or 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
| #!/usr/bin/env node | |
| // $ cat filewithduplicates.log | uniq.js | sort -rn | cut -f 2- | |
| var uniq = {}; | |
| require('readline').createInterface({ | |
| input: process.stdin, | |
| terminal: false | |
| }).on('line', function(line){ | |
| uniq[line] = ++uniq[line] || 1; | |
| }).on('close', function () { |
This file contains hidden or 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
| NEXTURL="http://bit.ly" | |
| while [ -n "$NEXTURL" ]; do | |
| RESP=$(curl -o /dev/null -s -w "%{time_total},%{redirect_url}" $NEXTURL); | |
| THISTIME=`echo -n "${RESP}" | cut -f 1 -d ","`; | |
| echo -ne "${THISTIME} : ${NEXTURL} \n"; | |
| NEXTURL=`echo -n "${RESP}" | cut -f 2 -d ","`; | |
| done |
This file contains hidden or 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
| var Rx = require('rx'); | |
| var zipper = function () { | |
| // Turning arguments from an object into an actual array so we can use things like map() | |
| return Array.prototype.slice.call(arguments); | |
| }; | |
| var array; // Given some array of Observables that you want zipped together | |
| // Or the more classical case where given an array of data to operate on, simply map them into observables |
This file contains hidden or 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
| #!/usr/bin/env node | |
| // $ echo "madam im adam" | ./plumber.js | |
| require('readline').createInterface({ | |
| input: process.stdin, | |
| terminal: false | |
| }).on('line', function(line){ | |
| process.stdout.write(line.split("").reverse().join("") + '\n'); | |
| }); |
This file contains hidden or 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
| /usr/bin/expect -c "set timeout 60; spawn ssh ${SSH_OPTS} ${USERID}@${HOST} \"mkdir -p ~/.ssh && echo \\\"`cat ~/.ssh/id_rsa.pub`\\\" >> ~/.ssh/authorized_keys\"; expect \"*?assword:*\"; send -- \"${PASSWD}\r\"; expect eof" |
NewerOlder