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
{ scopeName = 'source.js'; | |
comment = 'JavaScript Syntax: version 2.0'; | |
fileTypes = ( 'js', 'htc', 'jsx' ); | |
foldingStartMarker = '^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$'; | |
foldingStopMarker = '^\s*\}'; | |
patterns = ( | |
{ name = 'meta.class.js'; | |
comment = 'match stuff like: Sound.prototype = { É } when extending an object'; | |
match = '([a-zA-Z_?.$][\w?.$]*)\.(prototype)\s*(=)\s*'; | |
captures = { |
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
$('iframe:not(:visible)').remove(); | |
urls = ['https://edfuh.com', 'https://google.com']; i = 0; | |
[].slice.call(frames).forEach(function(f){ console.log(f.location.assign(urls[i++])) }) |
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
// Defining the application router, you can attach sub routers here. | |
var Router = Backbone.Router.extend({ | |
routes: { | |
"": "index" | |
}, | |
index: function() { | |
this.useLayout("main").setViews({ | |
header: new UI.Views.Toolbar() | |
}).render(); |
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 rgbToHex (r, g, b) { | |
return [].slice.apply(arguments).map(function (n) { | |
return n.toString(16); | |
}).join('').toUpperCase(); | |
} |
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
setInterval( function(){ | |
document.body.style.zoom = ((+document.body.style.zoom || 1) + 0.01) | |
},1000) |
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
keyExists = function(obj, structure) { | |
var F = function(){}; | |
F.prototype = obj; | |
var parts = structure.split('.'); | |
var testObj = new F; | |
for (var i = 0, j = parts.length; i < j; i++) { | |
if (!testObj[parts[i]]) { |
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 Countdown(seconds, update, done) { | |
this.length = seconds; | |
this.update = update; | |
this.done = done; | |
} | |
Countdown.prototype.start = function () { | |
var self = this; | |
self.update(self.length); |
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.Collection.extend({ | |
// #sadface | |
// collection.sadFilter().invoke('save') <- TypeError | |
sadFilter : function (m) { | |
return this.filter(function (m) { | |
return m.get('happiness') < 1 | |
}) | |
}, | |
// First option | |
// Wrap in underscore object |
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
#!/usr/bin/env node | |
// todo: try to require jshint here, instead of spawning process, then fallback to spawning process. | |
var jshint = nrequire('jshint'); | |
if (jshint) return process.exit(0); | |
// jshint not installed locally, spawn process instead. | |
// basically the same, but less pretty. | |
var exec = require('child_process').exec; |
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
// 'toaster'.toStartUpBand(); | |
String.prototype.toStartUpBand = function () { | |
return this.replace(/[^aeiuo]([aeiuo]{1})[^aeiuo]+$/g, function(m,m1){return m.replace(m1, '')}) + 'ly'; | |
}; |
NewerOlder