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
const transitionToPromise = (el, property, value) => | |
new Promise(resolve => { | |
el.style[property] = value; | |
const transitionEnded = e => { | |
if (e.propertyName !== property) return; | |
el.removeEventListener('transitionend', transitionEnded); | |
resolve(); | |
} | |
el.addEventListener('transitionend', transitionEnded); | |
}); |
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
Verifying that +davej is my Bitcoin username. You can send me #bitcoin here: https://onename.io/davej |
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
extendsScope_module = angular.module 'classy-extends', ['classy-core'] | |
### | |
Note that this does NOT get the mixin class dependencies as of now. | |
### | |
extendsScope_module.classy.plugin.controller | |
name: 'extends' | |
localInject: ['$controller'] |
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
/* | |
* To create a plugin you need to include the `classy-core` module and then pass | |
* your plugin object into the `class.plugin.controller function` | |
*/ | |
angular.module('classy-yourPlugin', ['classy-core']).classy.plugin.controller({ | |
name: 'yourPlugin', | |
/* | |
* Dependencies placed in the localInject array will be available on `@` (`this`) | |
* in the plugins init and postInit methods. |
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
### | |
# To create a plugin you need to include the `classy-core` module and then pass | |
# your plugin object into the `class.plugin.controller function` | |
### | |
angular.module('classy-yourPlugin', ['classy-core']).classy.plugin.controller | |
name: 'yourPlugin' | |
### | |
# Dependencies placed in the localInject array will be available on `@` (`this`) |
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
define [ | |
'base-ctrl' | |
], (BaseCtrl) -> | |
class AppController extends BaseCtrl | |
@register() | |
@inject('$scope') | |
init: -> | |
@$scope.foo = "bar" |
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
""" | |
A simple script to copy a Basecamp classic todo list | |
over to Blimp as a goal with tasks | |
@author: Dave Jeffery | |
@requirements: | |
pip install git+git://github.com/nowherefarm/basecamp.git | |
pip install blimp | |
""" |
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
// Illustrative case | |
// YEAH -- ILLUSTRATIVE OF THE FACT THAT YOU CAN ISSUE PARALLEL QUERIES TO THE DATABASE INSTEAD OF SERIAL ONES LIKE A DUMB THREADED IMPLEMENTATION THAT IS INFERIOR FOR DOING WEB SERVERS | |
function (recentBlogPostIds, callback) { // obviously you need this, but use callback instead of return | |
var results = [], // Use array not object | |
, len = recentBlogPostIds.length; // Cache length since we'll be using it more than once | |
for (var i = 0; i < len; i++) { | |
var blogPostId = recentBlogPostIds[i]; |
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
function cacheOrDB (id, callback) { | |
asynchronousCache.get("id:"+id, function(err, myThing) { | |
if (myThing == null) { | |
asynchronousDB.query("SELECT * from something WHERE id = "+id, function(err, myThing) { | |
callback(err, myThing); | |
}); | |
} else { | |
callback(err, myThing); | |
} | |
}); |
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
// helper function that goes inside your socket connection | |
client.connectSession = function(fn) { | |
var cookie = client.request.headers.cookie; | |
var sid = unescape(cookie.match(/connect\.sid=([^;]+)/)[1]); | |
redis.get(sid, function(err, data) { | |
fn(err, JSON.parse(data)); | |
}); | |
}; | |
// usage |