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(){ | |
var styleId = 'invert-style'; | |
var style = document.getElementById(styleId); | |
if (style) { | |
style.parentElement.removeChild(style); | |
} else { | |
style = document.createElement('style'); | |
style.id = styleId; | |
style.textContent = '' + | |
'html,img, video, object, [style*=url] {' + |
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
cd ~ | |
mkdir -p ~/.config | |
sudo apt-get install -y inotify-tools | |
sudo apt-get install -y tmux | |
git clone https://github.com/clupasq/clupasq.git $HOME/.config/clupasq | |
$HOME/.config/clupasq/setup.sh -o |
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 assertEquals(expected, actual){ | |
if(expected === actual){ | |
console.info('OK'); | |
} else { | |
console.error('(' + expected + ') !== (' + actual + ') !!!'); | |
} | |
} | |
function assertThrows(f){ | |
try{ |
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
# Creates a script that will: | |
# - customize the prompt to use posh-git-sh | |
# - add git-completion | |
DIRECTORY=~/.awesome-git-prompt | |
SCRIPT=~/git-prompt.sh | |
if [ ! -d "$DIRECTORY" ]; then | |
mkdir "$DIRECTORY" |
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
/* stolen from http://stackoverflow.com/a/5515960/390819 */ | |
function lengthInUtf8Bytes(str) { | |
/* Matches only the 10.. bytes that are non-initial characters in a multi-byte sequence. */ | |
var m = encodeURIComponent(str).match(/%[89ABab]/g); | |
return str.length + (m ? m.length : 0); | |
} | |
var answers = document.querySelectorAll('div.answer'); | |
var codeBoxes = Array.prototype.map.call(answers, function(a){ |
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
console.clear(); | |
function Car(name, loc) { | |
this.name = name; | |
this.loc = loc; | |
} | |
Car.prototype.move = function(){ | |
this.loc++; | |
console.log(this.name + "'s location is now " + this.loc.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
# taken from the "Design of Computer Programs" course by Peter Norvig | |
# https://www.udacity.com/course/cs212 | |
from functools import update_wrapper | |
def decorator(d): | |
"Make function d a decorator: d wraps a function fn." | |
def _d(fn): | |
return update_wrapper(d(fn), fn) | |
update_wrapper(_d, d) |
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
[editor] | |
;Show line numbers. | |
; Type: boolean | |
line_numbers = true | |
;Visible tabs. | |
; Type: boolean | |
visible_tabs = 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
(function () { | |
'use strict'; | |
var model = { | |
alarmActive: true | |
}; | |
var controller = { | |
init: function() { | |
if (this.alreadyRunning()) { |
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
map ,t :w\|!ruby %<cr> |