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
s x y z = x z (y z) | |
k x y = x | |
i = s k k | |
c = s (s (k (s (k s) k)) s) (k k) | |
b = s (k s) k | |
hello = | |
s(s(k s)(s(k k)(s(k s)(s(k(s(k s)))(s(s(k s)(s(k k)(s(k b)i)))(k(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s | |
b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(c k)))))))))))))))))))))))))))))))))))))))))) | |
)))))))))))))))))))))))))))(s(s(k s)(s(k k)(s(k s)(s(k(s(k s)))(s(s(k s)(s(k k)(s(k b)i)))(k(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s b(s |
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
// Copy paste in browser console | |
// F5 to stop interval | |
setInterval(function () { | |
[].filter.call(document.querySelectorAll('link'), function(el) { | |
return !/google|lorempixel/.test(el.href); | |
}).forEach(function (el) { | |
var href = el.href, | |
date = '?' + new Date().getTime(); | |
el.href = /\?/.test(href) ? href.replace(/\?.+/, date) : href + date; | |
}); |
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
// Super RegExp | |
// @param regex A regular expression as literal or as string | |
// @param obj And object containing the values to replace inside the regex | |
// Usage: var regex = sRegExp( /Hello #{a}/, { a: 'World' } ) | |
function sRegExp( regex, obj ) { | |
regex = regex.toString(); | |
var newRegex = regex.replace(/(^\/|\/$|\/([igm]+)$)/g, '') | |
.replace( /#\{(\w+)\}/g, function( a,b ) { return obj[b]; }); | |
var mods = regex.match( /\/([igm]+)$/ ); | |
return new RegExp( newRegex, mods ? mods[1] : '' ); |
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 | |
HOST=$(hostname) | |
function install_postfix() { | |
echo | sudo debconf-set-selections <<__EOF | |
postfix postfix/root_address string | |
postfix postfix/rfc1035_violation boolean false | |
postfix postfix/mydomain_warning boolean | |
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 |
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
$.fn.onlyChars = function( re ) { | |
return this.keypress(function( e ) { | |
return re.test( String.fromCharCode( e.which ) ) || | |
!!~[ 8,9,13,16,17,37,38,39,40 ].indexOf( e.which ); // Exclude modifier keys | |
}); | |
}; | |
// Usage: | |
// Keep in mind that the regex tests only a single character | |
$('input').onlyChars( /\d/ ); // only numbers |
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 typeOf( obj ) { | |
return {}.toString.call( obj ).match(/\s(\w+)/)[1].toLowerCase(); | |
} | |
function checkTypes( args, types ) { | |
args = [].slice.call( args ); | |
for ( var i = 0; i < types.length; ++i ) { | |
if ( typeOf( args[i] ) != types[i] ) { | |
throw new TypeError( 'param '+ i +' must be of type '+ types[i] ); | |
} |
Installs ruby-2.0.0-p0 on ubuntu via checkinstall so it's in your package manager and you can remove it.
Quick install:
curl -L https://gist.github.com/ngauthier/5039249/raw/1868bf4714052b40e2bb7fdf3f40fbeb5d730bca/ruby-2-install-ubuntu.sh | bash -s
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 toArray(args) { | |
return [].slice.call(args); | |
} | |
function autocurry(fn) { | |
var len = fn.length; | |
var args = []; | |
return function next() { | |
args = args.concat(toArray(arguments)); | |
return (args.length >= len) ? |
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
# If you meet install errors, see abid-hussain's comment | |
sudo apt-get --force-yes install build-essential openssl libreadline6 libreadline6-dev curl git-core \ | |
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \ | |
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison | |
&& | |
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled |