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
app.use(express.methodOverride()); | |
// ## CORS middleware | |
// | |
// see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs | |
var allowCrossDomain = function(req, res, next) { | |
res.header('Access-Control-Allow-Origin', '*'); | |
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); | |
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); | |
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
// the application | |
// | |
var AppView = Backbone.View.extend({ | |
el: $('body'), | |
initialize: function() { | |
var view = this; | |
// command 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
import itertools | |
def string_patterns(pattern, *args): | |
'''generator for string patterns''' | |
for data in itertools.product(*args): | |
s = pattern.format(*data) | |
yield s | |
# generate some urls! |
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
/** | |
* Shared Collections for backbone.js | |
*/ | |
// shared collection | |
// useful when the user may enter the site in multiple routes/views, | |
// but use the same collection | |
var SharedCollection = function(collection) { | |
var obj = 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
// ## Site Navigation View | |
// | |
var SiteNavView = Backbone.View.extend({ | |
model: new (Backbone.Model.extend({ | |
defaults: { | |
hasNew: undefined, | |
} | |
})), |
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
// ## Header View | |
// | |
var HeaderView = Backbone.View.extend({ | |
// model backing the view | |
model: new (Backbone.Model.extend({ | |
defaults: { | |
hasUpdate: false, | |
} | |
})), |
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
/* | |
modified from original source: https://bitbucket.org/mattkotsenas/c-promises/overview | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Promises |
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
import sys | |
import numpy as np | |
import scipy.ndimage as nd | |
from scipy.cluster.vq import vq | |
from scipy.misc import imsave | |
def crayola_9(): | |
""" | |
Palette of the first 8 crayola colors + white | |
""" |
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
// ## global namespace | |
// | |
var Leo = {} | |
// ## Leonardo Options | |
// | |
Leo.options = (function() { | |
return { | |
api : 'http://dev.leonar.do/api', |
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
class NewComics: | |
def __init__(self): | |
self.pages = None | |
@scrape.route('/newreleases') | |
def weekly(self, url, d): | |
# save the total number of pages | |
if self.pages is None: |
OlderNewer