by Ossi Hanhinen, @ohanhi
with the support of Futurice 💚.
Licensed under CC BY 4.0.
/* This WAS a two-line function until an awesome reddit user pointed out my logical flaw. Now It's a 5-line function :( */ | |
var Class = function(d){ | |
d.constructor.extend = function(def){ | |
for (var k in d) if (!def.hasOwnProperty(k)) def[k] = d[k]; | |
return Class(def); | |
}; | |
return (d.constructor.prototype = d).constructor; | |
}; |
import datetime | |
import simplejson | |
from pymongo.dbref import DBRef | |
from pymongo.objectid import ObjectId | |
class MongoEngineEncoder(simplejson.JSONEncoder): | |
"""Handles Encoding of ObjectId's""" |
#!/bin/sh | |
#################################### | |
# Output file for HTML5 video # | |
# Requirements: # | |
# - handbrakecli # | |
# - ffmpeg # | |
# - ffmpeg2theora # | |
# # | |
# usage: # |
#!/usr/bin/env ruby | |
# Aside from removing Ruby on Rails specific code this is taken verbatim from | |
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome | |
# - Ryan Florence (http://ryanflorence.com) | |
# | |
# Install this hook to a remote repository with a working tree, when you push | |
# to it, this hook will reset the head so the files are updated | |
if ENV['GIT_DIR'] == '.' |
from flask import Flask, request, redirect, url_for, make_response, abort | |
from werkzeug import secure_filename | |
from pymongo import Connection | |
from pymongo.objectid import ObjectId | |
from gridfs import GridFS | |
from gridfs.errors import NoFile | |
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) | |
DB = Connection().gridfs_server_test | |
FS = GridFS(DB) |
// jQuery.support.transition | |
// to verify that CSS3 transition is supported (or any of its browser-specific implementations) | |
$.support.transition = (function(){ | |
var thisBody = document.body || document.documentElement, | |
thisStyle = thisBody.style, | |
support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined; | |
return support; | |
})(); |
from fabric.api import * | |
""" | |
Base configuration | |
""" | |
env.project_name = '$(project)' | |
env.database_password = '$(db_password)' | |
env.site_media_prefix = "site_media" | |
env.admin_media_prefix = "admin_media" | |
env.newsapps_media_prefix = "na_media" |