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
//setStyle( | |
// document.getElementById('divId'), | |
// 'height: 180px; text-align: left; overflow-y: scroll;' | |
//); | |
var setStyle = function (elm, style) { | |
var rules = (function (style) { | |
var css, v, | |
rules = {}, | |
div = document.createElement('div'); |
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
--# HeroAttack | |
HeroAttack = class() | |
function HeroAttack:init(hero) | |
self.duration = 0.5 | |
self.currentTime = 0 | |
self.endTime = self.currentTime + self.duration | |
self.hero = hero | |
self.size = hero.size |
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
// Play with it here --> http://jsfiddle.net/Pdft8/2/ | |
Function.waitUntil = function(fn, condition, interval, stopOnReady) { | |
var defaults = { | |
pageReady: function() { | |
return (/complete|loaded|interactive/).test(document.readyState); | |
}, | |
pageLoad: function() { | |
return (/complete|loaded/).test(document.readyState); | |
} |
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
// [ | |
// { 'id': '123', 'amt': '300', 'price': '3' }, | |
// { 'id': '124', 'amt': '400', 'price': '4' }, | |
// { 'id': '125', 'amt': '500', 'price': '5' } | |
// ].joseify(); | |
// | |
// ==> '123|300|3[124|400|4[125|500|5' | |
Array.prototype.joseify = function (fieldSep, rowSep) { | |
fieldSep = fieldSep || '|'; | |
rowSep = rowSep || '['; |
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 User(first, last){ | |
if ( !(this instanceof User) ) | |
return new User(first, last); | |
this.name = first + " " + last; | |
} | |
var name = "Resig"; | |
var user = User("John", name); |
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 (name, self, d) { | |
self[name] = function (src, cb) { | |
cb = cb || function () {}; | |
var newScriptTag = d.createElement('script'), | |
firstScriptTag = d.getElementsByTagName('script')[0]; | |
newScriptTag.src = src; | |
newScriptTag.async = true; | |
newScriptTag.onload = newScriptTag.onreadystatechange = function () { |
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
var s = ''.concat( | |
'<div class="heading">', | |
'<div class="firstname">', | |
'{firstname}', | |
'</div>', | |
'<div class="lastname">', | |
'{lastname}', | |
'</div>', | |
'</div>' | |
); |
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
var s = 'var i = 10; while (i--) { console.log(i); }'; | |
(new Function(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
val doubleEvenNumbers = new PartialFunction[Int, Int] { | |
def isDefinedAt(x: Int) = x % 2 == 0 | |
def apply(v1: Int) = v1 * 2 | |
} | |
val tripleOddNumbers = new PartialFunction[Int, Int] { | |
def isDefinedAt(x: Int) = x % 2 != 0 | |
def apply(v1: Int) = v1 * 3 | |
} |
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 |