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
// Using Example A or B | |
require(['scripts/mousetrap'], function(Mousetrap) { | |
// Mousetrap is not returned from a module its actually a reference to window.Mousetrap | |
}); | |
// Using Example C or D | |
require.config({ | |
baseUrl: 'scripts', | |
paths: { | |
mousetrap: 'script/mousetrap' |
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
<?php | |
/* | |
Plugin Name: Email Obfuscation Shortcode | |
Plugin URI: https://gist.github.com/1424515 | |
Description: Shortcode for including emails into content and keeping spambots clueless. [obf email="email@example.com" noscript="what's shown to bots/people without javascript"] | |
Version: 0.1 | |
Author: Ismo Vuorinen | |
Author URI: http://github.com/ivuorinen | |
*/ |
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 onMouseMove() { | |
const mousePosition = d3.mouse(this) | |
const hoveredDate = xScale.invert(mousePosition[0]) | |
const getDistanceFromHoveredDate = d => Math.abs(xAccessor(d) - hoveredDate) | |
const closestIndex = d3.scan(dataset, (a, b) => ( | |
getDistanceFromHoveredDate(a) - getDistanceFromHoveredDate(b) | |
)) | |
const closestDataPoint = dataset[closestIndex] |
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
//http://jsfiddle.net/vYb72/1/ | |
/* | |
* @param String frame_id The id of the div containing the frame | |
* @param String func Desired function to call, eg. "playVideo" | |
* @param Array args (optional) List of arguments to pass to function func*/ | |
function callPlayer(frame_id, func, args){ | |
/*func: playVideo, pauseVideo, stopVideo, ... Full list at: | |
* http://code.google.com/apis/youtube/js_api_reference.html#Overview */ | |
if(!document.getElementById(frame_id)) return; | |
args = args || []; |
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
'use strict'; | |
// | |
// # Option | |
// | |
// Option a = Some a + None | |
// | |
// The option type encodes the presence and absence of a value. The | |
// `Some` constructor represents a value and `None` represents the | |
// absence. |
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
// http://compass-style.org/reference/compass/helpers/sprites/ | |
@mixin get-sprite($map, $sprite, $repeat: no-repeat, $height: true, $width: true) | |
//http://compass-style.org/reference/compass/helpers/sprites/#sprite-file | |
$sprite-image: sprite-file($map, $sprite) | |
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-url | |
$sprite-map: sprite-url($map) | |
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-position |
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.Events | |
// --------------- | |
// A module that can be mixed in to *any object* in order to provide it with | |
// custom events. You may bind with `on` or remove with `off` callback | |
// functions to an event; `trigger`-ing an event fires all callbacks in | |
// succession. | |
// | |
// var object = {}; | |
// _.extend(object, Backbone.Events); |
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 Animation( elem, properties, options ) { | |
var result, | |
stopped, | |
index = 0, | |
length = animationPrefilters.length, | |
deferred = jQuery.Deferred().always( function() { | |
// don't match elem in the :animated selector | |
delete tick.elem; | |
}), | |
tick = 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
// Backbone.Router | |
// --------------- | |
// Routers map faux-URLs to actions, and fire events when routes are | |
// matched. Creating a new one sets its `routes` hash, if not set statically. | |
var Router = Backbone.Router = function(options) { | |
options || (options = {}); | |
if (options.routes) this.routes = options.routes; | |
this._bindRoutes(); | |
this.initialize.apply(this, 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
define(['lib/namespace', 'lib/extend'], function(namespace, extend) { | |
'use strict'; | |
var breaker = {}; | |
var // Keep the identity function around for default iterators. | |
identity = function(value) { | |
return value; | |
}, |
NewerOlder