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
/* | |
https://gist.github.com/wteuber/2c481f5f81d2efd39d97 | |
https://jsfiddle.net/f6f2jves/2/ | |
<body> | |
<input id="iban" type="text" size="30" autofocus><br> | |
<span id="check">invalid IBAN</span> | |
</body> | |
*/ |
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
$(document).ready(function() { | |
$(window).keydown(function(event){ | |
if((event.keyCode == 13 || event.keyCode == 10) && !event.ctrlKey) { | |
event.preventDefault(); | |
return 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
document.body.setAttribute('style', 'margin:0;padding:0;'); document.body.innerHTML = '<body style="margin:0;padding:0;"><div style="width: 100vw;height: 100vh;display: table;"><div style="background: #00f;width: 33%;display: table-cell;"></div><div style="background: #fff;width: 33%;display: table-cell; color: #CCC;text-align:center;vertical-align:middle;font-size: 12vh;">Solidarité</div><div style="background: #f00;width: 33%;display: table-cell;"></div></div></body>'; |
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 | |
require 'yaml' | |
require 'active_support/all' | |
puts ARGV.map{|file| YAML.load_file(file)}.inject(&:deep_merge).to_yaml |
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 | |
require 'yaml' | |
require 'active_support/all' | |
class Hash | |
def to_hash_recursive | |
result = self.to_hash | |
result.each do |key, value| |
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
for f in `git ls-files "*.rb"`; do ruby -c $f | grep -v "Syntax OK" ; done |
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 | |
require 'yaml' | |
class Hash | |
def deep_reject(&blk) | |
self.dup.deep_reject!(&blk) | |
end | |
def deep_reject!(&blk) | |
self.each do |k, v| |
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
ary.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total} |
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
foo = Namespace::To::Module.instance_method(:foo) | |
obj.class.send(:define_method, :foo, foo) |
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
ls **/en.yml **/de.yml | grep -v spec| tar -czf archive.tgz -T - |