[ Launch: Lorenz Curve ] 9767676 by stevekinney
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
// relies on Date.now() which has been supported everywhere modern for years. | |
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values | |
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page | |
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed | |
(function(){ | |
// prepare base perf 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
function consoleLogo(width,height,url,comment){ | |
'use strict'; | |
//config | |
var lineHeight = 14; | |
//build string | |
var str = ''; | |
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
library wildcard_filter; | |
import 'package:angular/angular.dart'; | |
class WildcardFilter{ | |
static final String DEFAULT_SEPARATOR = ' '; | |
/* | |
* AngularJS Filter fnc "call" |
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
/* global famous */ | |
define(function(require, exports, module) { | |
var Utility = famous.utilities.Utility; | |
var MouseSync = famous.inputs.MouseSync; | |
var TouchSync = famous.inputs.TouchSync; | |
var ScrollSync = famous.inputs.ScrollSync; | |
var GenericSync = famous.inputs.GenericSync; | |
var Transitionable = famous.transitions.Transitionable; | |
var Easing = famous.transitions.Easing; |
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 isWeixin = false; | |
if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") { | |
isWeixin = true; | |
} else { | |
if (document.addEventListener) { | |
document.addEventListener("WeixinJSBridgeReady", function() { isWeixin = true; }, false); | |
} else if (document.attachEvent) { | |
document.attachEvent("WeixinJSBridgeReady", function() { isWeixin = true; }); | |
document.attachEvent("onWeixinJSBridgeReady", function() { isWeixin = true; }); |
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
// long version | |
function loadExt(files, after) { | |
var _this=this; | |
_this.files = files; | |
_this.js = []; | |
_this.head = document.getElementsByTagName("head")[0]; | |
_this.after = after || function(){}; | |
_this.loadStyle = function(file) { | |
var link = document.createElement("link"); | |
link.rel = "stylesheet"; |
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
/** | |
* parseTemplate takes a string and a JS Object and returns a string with template | |
* replaced with content you provided. Template tags look like: {{tag}} | |
* @param {String} s This is the string to search for tags in. | |
* @param {Object} j This is the JS object that contains a key=>value pair for the tag and what to be replaced | |
* @returns {String} returns the modified string with the content you provided in replacement of the tags | |
* @example var html = parseTemplate('Hey, {{name}}',{ name:'John' }); //returns "Hey, John" | |
*/ | |
var parseTemplate = function(s,j){ | |
for(x in j){ var r = new RegExp('{{'+x+'}}','g'); s = s.replace(r,j[x]); } |
This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.
It's a modification of the default project created with the yo keystone
generator (see https://github.com/JedWatson/generator-keystone)
Gists don't let you specify full paths, so in the project structure the files would be:
routes-index.js --> /routes/index.js // modified to add the api endpoints
routes-api-posts.js --> /routes/api/posts.js // new file containing the Post API route controllers
OlderNewer