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 (!Function.prototype.bind) { | |
Function.prototype.bind = function (context) { | |
if (typeof this !== 'function') throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); | |
var args = Array.prototype.slice.call(arguments, 1), | |
fToBind = this, | |
fn = function () {}, | |
fBound = function () { | |
return fToBind.apply(this instanceof fn && context ? this : context, | |
args.concat(Array.prototype.slice.call(arguments))); | |
}; |
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
[mergetool] | |
prompt = false | |
keepBackup = false | |
keepTemporaries = false | |
[merge] | |
tool = winmerge | |
[mergetool "winmerge"] | |
name = WinMerge |
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
<form class="form"> | |
<input type="text" placeholder="enter text" name="name" value=""> | |
<input type="checkbox" name="check"> | |
<select name="select"><option value="select1">one</option><option value="select2">two</option></select> | |
<input name="radio" type="radio" value="radio1"> | |
<input name="radio" type="radio" value="radio2"> | |
</form> | |
<button class="start">Observe</button> | |
<button class="stop">Stop observing</button> |
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
/** | |
* Formats numbers (or string numbers) | |
* @param number int or int-parsable string | |
* @param prec decimal precision | |
* @returns formatted number as string | |
*/ | |
numberFormat : function (number, prec) { | |
var ext, name, numS, rgx = /(\d+)(\d{3})/; | |
number = number || '0'; | |
prec = prec || 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
/** | |
* LESS mix-in library | |
* vendor prefixes verified with prefixr.com and caniuse.com [2012-09-28] | |
* https://gist.github.com/3798764 | |
*/ | |
@img-base: "../img"; | |
@icon-base: "../img/icons"; | |
.b(@v) when (@v = 0) { font-weight: normal; } |
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
// Array Remove - By John Resig (MIT Licensed) | |
Array.prototype.remove = function(from, to) { | |
var rest = this.slice((to || from) + 1 || this.length); | |
this.length = from < 0 ? this.length + from : from; | |
return this.push.apply(this, rest); | |
}; |
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
// import sql file | |
$file_content = file('updates.sql'); | |
$query = ""; | |
foreach($file_content as $sql_line){ | |
if(trim($sql_line) != "" && strpos($sql_line, "--") === false){ | |
$query .= $sql_line; | |
if (substr(rtrim($query), -1) == ';'){ | |
$result = $dbo->dbEdit($query); | |
echo $query.'<br>Result: '.($result==1?'OK':$result).'<br><br><br>'; | |
$query = ""; |
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 validate(f,v,a,x){ | |
for(a=0;x=f[a++];) | |
if((v=window[x.getAttribute('valid')])&&!v(x.value)){ | |
alert(x.getAttribute('alert')); | |
return !x.focus(); | |
} | |
} | |
function notempty(x){return x>''} | |
function ismail(e){return /^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/i.test(e)} |
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
new Array(20).join('.') |
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
$.ajax({ url: '//www.google.com/jsapi', dataType: 'script' }).done(function () { | |
var addr = google.loader.ClientLocation.address; | |
console.log(addr); | |
}); | |
$.getJSON('//freegeoip.net/json/', function(location) { | |
console.log(location); | |
}); |