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
// including . | |
.toFixed(n).replace(/\.0*$|(\.[^0]+)0+$/, '$1') | |
// leaving 1 decimal digit | |
.toFixed(n).replace(/(\..+?)0+$/, '$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
# Backbone.Validator | |
# jQuery Validation (?) | |
///^ | |
( | |
( | |
([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+ | |
(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)* | |
) | |
| | |
((\x22)( |
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
apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libsqlite3-dev |
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
def p(i) | |
(i.to_s.chop.chars<<'%02d'%i).join '/' | |
end |
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
String.random=(q=1)-> | |
s='' | |
while s.length<q | |
n=Math.floor 62*Math.random() | |
s+=String.fromCharCode n%26+'Aa0'.charCodeAt n/26 | |
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 Base64Decode(Const S: String): String; | |
Var | |
i: Integer; | |
W, Buffer, Bits: Word; | |
Begin | |
Result:=''; | |
Bits:=0; Buffer:=0; W:=0; | |
For i:=1 To Length(S) Do | |
Begin | |
Case S[i] Of |
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
String::wordWrap=(cols=75, rows=1)-> | |
@match(RegExp ".{1,#{cols}}(\\s|$)|.{#{cols}}|.+$", 'g').slice(0, rows).join '\n' |
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
Number::declension=(forms)-> | |
n=/[.,]|1?[1-4]$|$/.exec(@)[0] | |
n=if 1!=n.length then 0 else if '1'==n then 1 else 2 | |
if arguments.length>1 then arguments[n] else if forms then forms[n] else n |
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.prototype.new = function(){ | |
var args = arguments | |
var constructor = this | |
function Fake(){ | |
return constructor.apply(this, args) | |
} | |
Fake.prototype = this.prototype | |
return new Fake | |
} |
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
positive = /^(?!0\d|\.?$)\d*\.?\d*$/ | |
number = /^[-+]?(?!0\d|\.?$)\d*\.?\d*$/ |
OlderNewer