This file contains hidden or 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
// There is *nothing* wrong with changing prototypes in your own code! | |
// If you're writing a library or framework or a module that has to | |
// interface with someone else's code then things are a little different, | |
// but even then some conservative changes can be safe. | |
// In particular, it's not hard to implement an Object.prototype.forEach | |
// that works just like Array.prototype.forEach and is very fast. | |
// See: https://github.com/creationix/proto/blob/master/lib/proto.js#L23-36 | |
// Since it uses Object.defineProperty, the new prototype is not | |
// enumerable and won't even break people doing for..in loops over | |
// objects (which is the *slowest* way to iterate over an object) |
This file contains hidden or 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
// -------------------------- Resize event handler ------------------------------------ // | |
// Fires an event after resizing has finished | |
var resizeEvent, resizeTimer = null; | |
$(window).bind('resize', function() { | |
if (resizeTimer) clearTimeout(resizeTimer); | |
resizeTimer = setTimeout(resizeEvent, 100); | |
}); | |
resizeEvent = function() { | |
$(window).trigger('responsiveResize'); |
This file contains hidden or 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
# Module/Plugin core | |
# Note: the wrapper code you see around the module is what enables | |
# us to support multiple module formats and specifications by | |
# mapping the arguments defined to what a specific format expects | |
# to be present. Our actual module functionality is defined lower | |
# down, where a named module and exports are demonstrated. | |
# | |
# Note that dependencies can just as easily be declared if required | |
# and should work as demonstrated earlier with the AMD module examples. |
This file contains hidden or 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
edit: (params) -> | |
@set 'channel', Ems.Channel.find parseInt(params.id), (err) -> throw err if err | |
Ems.Category.load (err, categories) => | |
throw err if err | |
@set 'categories', categories | |
console.log 'Categories returned: ', categories | |
# RETURNS: | |
# | |
# > Categories returned: [ Category, Category, Category ] |
This file contains hidden or 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
!(( $ ) -> | |
"use strict" | |
# CLASSNAME CLASS DEFINITION | |
# ========================== # | |
ClassName = ( element, options) -> | |
process = $.proxy(@.process, this) | |
$element = if $(element).is('body') then $(window) else $(element) |
This file contains hidden or 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
# ============================================================ | |
# PluginName v0.0.0 | |
# http://URL | |
# ============================================================ | |
# Copyright 2012 The Beans Group | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains hidden or 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({ | |
type: "GET", | |
url: "/categories.json", | |
data: {query: { order: "load_order"}} | |
}).done(function( msg ) { | |
console.log( "Data: ", msg ); | |
}); |
This file contains hidden or 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
# Usage: | |
# temp_converter.convertTo('f') | |
# temp_converter.convertTo('c') | |
temp_converter = | |
temps: ['.temphigh', '.templow'] | |
currentUnit: 'f' | |
toCelsius: (f)-> | |
@currentUnit = 'c' |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Usage: curl -L https://raw.github.com/gist/3264663/570727e122e8ebec1f6b6cc98fd2ee07d75bf7f9/gistfile1.sh | sh | |
# | |
# [email protected] | |
function link_zsh { | |
ln -s ~/Google\ Drive/yadr-customisations/zsh ~/.yadr/custom/zsh | |
} |
This file contains hidden or 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
# ============================================================ | |
# PluginName v0.0.0 | |
# http://URL | |
# ============================================================ | |
# Copyright 2012 The Beans Group | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
OlderNewer