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 http = require('http'); | |
const server = http.createServer(); | |
server.on('request', (request, response) => { | |
let body = []; | |
request.on('data', (chunk) => { | |
body.push(chunk); | |
}).on('end', () => { | |
body = Buffer.concat(body).toString(); |
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
#!/bin/bash | |
function get_active_window() { | |
printf "0x%08x" $(xdotool getactivewindow) | |
} | |
function get_current_opacity() { | |
window="$1" | |
opacity=$(xprop -id $window | grep _NET_WM_WINDOW_OPACITY | awk '{print $3}') | |
if [ -z $opacity ]; then |
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
#!/bin/bash | |
# Check package availability | |
command -v docker-compose >/dev/null 2>&1 || { echo "[Error] Please install docker-compose"; exit 1; } | |
command -v gzip >/dev/null 2>&1 || { echo "[Error] Please install gzip"; exit 1; } | |
# Change to the script's directory & create directory | |
cd $(dirname "$(readlink -f "$0")") | |
mkdir -p ./dbdumps |
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
KEYBINDINGS | |
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings | |
are: | |
F2 - Create a new window | |
F3 - Move to previous window | |
F4 - Move to next window |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
}); |
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 talk(){ | |
console.log(this.sound); | |
} | |
let animal = { | |
talk | |
}; | |
let cat = { | |
sound: "Miau!" |
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 (/* 01. reduce (v, fn, b) */) { | |
var reduce = function (v, fn, b) { | |
return reduceAux (v, fn, b, 0, b); | |
}; | |
var reduceAux = function (v, fn, b, p, ac){ | |
return p > v.length - 1 ? | |
ac : |
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
var fullname = 'John Doe'; | |
var obj = { | |
fullname: 'Colin Ihrig', | |
prop: { | |
fullname: 'Aurelio De Rosa', | |
getFullname: function() { | |
return this.fullname; | |
} | |
} | |
}; |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
init() { | |
this._super(...arguments); | |
console.log(this.get('myArr')) | |
}, | |
myArr: Ember.A([]), | |
actions: { |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
myArr: Ember.K, | |
actions: { | |
addNumber() { | |
let random = Math.ceil(10 * Math.random()); | |
this.get('myArr').pushObject(random); |
NewerOlder