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
# Update the system's packages | |
apt-get update | |
apt-get upgrade | |
# Set up the `deploy` user | |
useradd deploy | |
mkdir /home/deploy | |
mkdir /home/deploy/.ssh | |
chmod 700 /home/deploy/.ssh | |
usermod -s /bin/bash deploy |
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
// --------------------------------------------- Promise Implementation | |
Promise = function () { | |
this._stack = []; | |
this._isResolved = false; | |
} | |
Promise.prototype = { | |
success: function(callback){ | |
// Is the promise already resolved? | |
if(this._isResolved) { | |
callback( this._result ); |
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 fs = require('fs') | |
const path = require('path') | |
const DIR = 'input/'; | |
const readFile = name => fs.readFileSync(name); | |
(async () => { | |
const files = fs.readdirSync(DIR) | |
.filter(s => s.match(/\.csv$/)) // only .csv files -- change to whatever you want. |
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
export interface SomeShape { | |
b: string, | |
c: string, | |
a: string, | |
} | |
// Specify your sort order here | |
const rank: Array<keyof SomeShape> = ['a', 'b', 'c']; | |
export function sortedKvpString(obj: SomeShape) { |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "cmd+d", | |
"command": "editor.action.copyLinesDownAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+down", | |
"command": "-editor.action.copyLinesDownAction", |
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
// Procedure: | |
countWords(document.body); | |
/* | |
* Count the text inside each element. | |
* Parents include all the words of their children. |
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
'atom-text-editor': | |
'cmd-backspace': 'editor:delete-line' | |
'cmd-up': 'editor:move-line-up' | |
'cmd-down': 'editor:move-line-down' | |
'cmd-d': 'editor:duplicate-lines' |
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
// Lights (white as a transparency) | |
$light10: rgba(255, 255, 255, 0.10); | |
$light20: rgba(255, 255, 255, 0.20); | |
$light30: rgba(255, 255, 255, 0.30); | |
$light40: rgba(255, 255, 255, 0.40); | |
$light50: rgba(255, 255, 255, 0.50); | |
$light60: rgba(255, 255, 255, 0.60); | |
$light70: rgba(255, 255, 255, 0.70); | |
$light80: rgba(255, 255, 255, 0.80); |
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 Foundation | |
/* | |
A starter animation library for swift. | |
These abstractions make it easier to chain multiple behaviors (eg: anticpate, then slam, then fade) | |
because you can use them as single liners and reason only about the actions. | |
Usage: |
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
// Pull a secret string out of ordered triplets | |
// https://www.codewars.com/kata/recover-a-secret-string-from-random-triplets/train/javascript | |
// https://www.codewars.com/kata/53f40dff5f9d31b813000774/solutions/javascript | |
// @LesRamer | |
var recoverSecret = function(triplets) { | |
for(var [first] of triplets) | |
{ | |
if (triplets.every(tuple => tuple.indexOf(first) <= 0)) | |
{ |