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
| import request from 'superagent-bluebird-promise' | |
| const ad = async promise => { | |
| const [err,resp] = await promise.then(x=>[{},x]).catch(x=>[x, {}]) | |
| const [{message},{body}] = [err, resp] | |
| return [message, body] | |
| } | |
| async function handlesSuccess(){ | |
| const [errorMessage, requestBody] = await ad(request.get('https://jsonplaceholder.typicode.com/posts/1').promise()) |
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
| export default const rotate2dArray = array => { | |
| const resultLength = array[0].length | |
| const resultArray = Array(resultLength).fill([]) | |
| return resultArray.map((x, widthIndex) => | |
| array.map(innerArray => innerArray[widthIndex]) | |
| ) | |
| } |
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
| 043f000e1bdc9b7c8782e8813c9c97310a02f056f26caf1e79e7138dcf84adcb673a67751ce91d61b2d79e42a48c816fc5b6579e84bf6edcd8ed438beb0a7ff9de;Sheing |
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
| import makeGetUser from './github' | |
| import request from './request' | |
| const getUser = makeGetUser({request}) | |
| getUser('michaelwclark') | |
| .then(console.log) |
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
| function killPort(){ | |
| lsof -i tcp:$1 | awk '{print $2}' | grep -v 'PID' | xargs kill | |
| } |
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
| options = ['St Louis', 'KC', 'Omaha', 'Minneappolis','Branson', 'Nashville', 'Indy']; | |
| votes = [0,0,0,0,0,0,0] | |
| for(count = 0; count < 10; count++){ | |
| let idx = Math.floor(Math.random() * options.length) | |
| votes[idx]++ | |
| } | |
| document.open(); | |
| document.close(); | |
| document.write('Winner: ' + options[votes.indexOf(Math.max(...votes))]) |
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
| <html> | |
| <style type="text/css"> | |
| .container{width:400px;} | |
| .container .element {width:33%; float:left;} | |
| .blue {background:blue;} | |
| .orange {background:orange;} | |
| .gray {background: gray;} | |
| </style> | |
| <div class="container"> | |
| <div class="element blue"> </div> |
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
| <?php | |
| /** | |
| * Tries to force the minicalendar widget to show the month of the next upcoming event by default, rather | |
| * than simply showing the current month (which might be empty). | |
| */ | |
| class Tribe_Advance_Minical | |
| { | |
| protected $target_date = false; | |
| /** |
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 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://npmjs.org/install.sh | sh |
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
| import sublime, sublime_plugin | |
| class DefaultSyntaxCommand(sublime_plugin.EventListener): | |
| def on_new(self, view): | |
| view.set_syntax_file('Packages/Ruby/Ruby.tmLanguage') |