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
//one statement - all on one line - good for short, similar purpose vars | |
var foo = [], bar = [], buzz = []; | |
//multiple var statements - good for large number or disperate purpose vars | |
var a = 12; | |
var collate = false; | |
var foo = [1,2,3,4]; | |
var circle = {radius: 2, color: blue}; | |
//one statement on multiple lines, no indent |
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
/** | |
NOTE: The template in this example relies on itemView, which is not yet | |
in SproutCore 2.0 master, but is coming | |
*/ | |
MyApp.Selection = SC.Object.extend({ | |
name: null, | |
isSelected: 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
ISTOUCHING = false; | |
function useTouchEvents() { | |
return isTouchDevice(); | |
} | |
function triggerClick(dom) { | |
if (useTouchEvents()) { | |
dom.trigger('tap'); | |
} else { |
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
// | |
// Place this at the beginning of your node.js program before | |
// **any and all** require statements. | |
// | |
var util = require('util'); | |
var _warning = util._deprecationWarning; | |
util._deprecationWarning = function () { | |
console.trace(); | |
_warning.apply(util, 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
// add your variants of | |
a ? b : c | |
// in comments :) | |
// a is boolean | |
// b and c - any type | |
// lazy evaluation isnt important |
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 future = function(expectedCalls, action) { | |
var counter = 0; | |
return function() { | |
counter++; | |
if (counter === expectedCalls) action(); | |
} | |
} | |
var products = [ {id:1}, {id:2}, {id:3}, {id:4}, {id:5} ]; |
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
try | |
tell application "Safari" to activate | |
tell application "System Events" | |
tell process "Safari" | |
tell menu bar 1 | |
tell menu bar item "Develop" | |
tell menu "Develop" | |
tell menu "iPhone Simulator" of menu item "iPhone Simulator" | |
delay 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
Copyright (c) 2015 - Xavier Cambar <@ xcambar_gmail.com> | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in |
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
.clear-btn { | |
width: 19px; | |
height: 19px; | |
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAMAAACf4xmcAAAAMFBMVEWysrKysrKysrKysrKysrKysrKysrKysrKysrKysrL////39/fh4eG9vb23t7eysrKQDTJbAAAACnRSTlMBKlNxqbO70e7739UFWQAAAMFJREFUeNqNlMsOxSAIREs1AbVe/v9v78JMSn0kMytJTzqIwPWRpKxWimlOcp2U1IM07SHzSbaCor6RTta3+VZ2f6jiB5WboSIncNzKkB+yP0gHlRD/cJjCURdYPrX1F+qtPrCNP+u1Dg5UrYhSzKyBA9VCdhJtwOEICTzjx0jBNfvCLZRnpBa5SCE584WLFEpSfMOBggqJkabkFciCkOUlH4t7erKRuLYkm5wbGXIAuXHmlgO3asjFxa9BfqmSK/oPfl489V95hyMAAAAASUVORK5CYII='); | |
background-size: 100%; | |
cursor: pointer; | |
} |
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
/x/==x |