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
(![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]] | |
/*"fail"*/ | |
(![]+[])[ +[] ] /*("false")[0]*/ | |
+ | |
(![]+[])[ +!+[] ] /*("false")[1]*/ | |
+ | |
([![]]+[][[]])[ +!+[]+[+[]] ] /*("falseundefined")[10]*/ | |
+ |
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
################# CODE ################# | |
def standup_note | |
'heute: Standup ' + ((Time.now.day % 2).zero? ? 'gegen den ' : 'im ') + 'Uhrzeigersinn' | |
end | |
################# PREP ################# | |
class String | |
def should_include(part) | |
raise '...but it does not!' unless self.include?(part) |
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
#!/usr/bin/env ruby | |
# Sort your rails locale yamls alphabetically and adds an empty line when indent lowers 2 or more levels | |
# Prints everything to stdout. Watch your yaml anchors and aliases (fix manually, if needed). | |
# usage: | |
# chmod +x ./locale_yaml_formatter.rb | |
# ./locale_yaml_formatter.rb <path/to/locale.yml> | |
# | |
# In a rails project, run | |
# find . -type f -name *.yml | grep -v spec | grep locales | _ |
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
git checkout master | |
git reset --hard origin/master | |
git remote -v | |
#should list origin (fork) and upstream (original repo) | |
#git remote add upstream https://github.com/original/repo.git | |
git fetch upstream | |
git merge upstream/master | |
git push origin master | |
#also see https://help.github.com/articles/syncing-a-fork |
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
/* | |
fmod for Javascript, will work with any ECMA-262 implementation. | |
If you need a precision higher than 8, please use another implementation of fmod. | |
1.05 % 0.05 | |
=> 0.04999999999999999 | |
Math.fmod(1.05, 0.05) | |
=> 0 |
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
/*This will alert 'WHAT?':*/ | |
if (100000000000000001 === 100000000000000000) { alert('WHAT?'); } |
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
/*jslint indent: 2 */ | |
/* toFixed converts the input to a number and returns it rounded to 2 decimal places */ | |
/* For a deeper insight on javascript numbers, read http://ecma-international.org/ecma-262/5.1/#sec-8.5 */ | |
function toFixed(val) { | |
'use strict'; | |
var floatError = 1000000, /* floating point errors less than (1/floatError) == 0.000001 will be corrected */ | |
decRound = 100, /* the result is rounded to integer multiples of (1/decRound) == 0.01 */ | |
n = parseFloat(val), /* convert input to floating point number */ | |
sign = n < 0 ? '-' : '', /* sign of the given input */ | |
intFrac, /* integer and fractional parts of a decimal number */ |
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
/*jslint indent: 2 */ | |
// http://toys.usvsth3m.com/javascript-under-pressure/ | |
function doubleInteger(i) { | |
'use strict'; | |
// i will be an integer. Double it and return it. | |
return i * 2; | |
} | |
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
# Ruby's floating point errors | |
# "Sometimes it's easier avoiding a problem than solving it." | |
0.2 > (1.to_r/5) # false | |
0.2.to_r == 0.2 # true | |
0.2.to_r > (1.to_r/5) # true | |
# There is a certain range of floating point calculation errors, which is ignored. | |
0.2.to_r # (3602879701896397/18014398509481984) | |
0.2.to_r - (1.to_r/5) # (1/90071992547409920) (it should be 0) |
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
/* ~/.config/gtk-3.0/gtk.css */ | |
TerminalWindow .notebook tab { | |
background-color: #AAA; | |
} | |
TerminalWindow .notebook tab:active { | |
background-color: #FFF; | |
} |