EyePulp EyePulp

View pubsub-simple.js
1 2 3 4 5 6 7 8 9 10
define([], function() {
/* See also: "Learning Javascript Design Patterns" by Addy Osmani
* http://addyosmani.com/resources/essentialjsdesignpatterns/book/
*
* for examples on how to use pubsub as event aggregator (Mediator)
*
*/
var pubsub = function(){};
(function(q) {
var topics = {}, subUid = -1;
View autossh.yaml
1 2 3 4 5 6 7 8 9 10
---
# set up an ssh tunnel
# using the following variables
# {{AUTOSSH_PUBLIC_KEY_SRC}}
# {{AUTOSSH_PUBLIC_KEY_DEST}}
# {{AUTOSSH_PRIVATE_KEY_SRC}}
# {{AUTOSSH_PRIVATE_KEY_DEST}}
# {{AUTOSSH_UPSTART_SRC}}
# {{AUTOSSH_UPSTART_DEST}}
# {{AUTOSSH_UPSTART_SERVICE}}
View Vagrantfile
1 2 3 4 5 6 7 8 9
 
 
Vagrant.configure("2") do |config|
 
config.vm.synced_folder File.dirname(__FILE__)+'/../', "/vagrant-project/"
config.vm.define "project_foo" do |app|
 
app.vm.box = "precise64"
app.vm.box_url = "http://files.vagrantup.com/precise64.box"
View main.js
1 2 3 4 5 6
require(['some_module'], // import your module
function(mm){ // give it a local reference
var MyInstance = new mm({'yo':'ho ho'}); // instantiate it with a value
MyInstance.bar(); // run some functions off of it
}
);
View ko.binding.js
1 2 3 4 5 6 7 8
ko.bindingHandlers.console = {
init: function (element, valueAccessor,allBindingsAccessor) {
console.info('ko.console:',valueAccessor());
},
update: function (element, valueAccessor, allBindingsAccessor) {
console.info('ko.console:',valueAccessor());
}
};
View gist:5815203
1 2 3 4 5 6 7 8 9 10
var Payment = kb.Model.extend({
urlRoot: '/api/v1/payment_backbone/'
});
 
var PaymentCollection = kb.Collection.extend({
model: Payment
 
// Constructor method
, initialize: function(data, options) {
this.limit = options.limit || 20;
View example.js
1 2 3 4 5 6 7 8 9 10
// usage inside a vm:
var fooVM = function(){
var self = this;
var resource_uri = ko.observable('/api/v1/foo/');
var bar = ko.observable(1);
var baz = ko.observable(1);
ko.saveOnChange(self,['bar']);
}
var f = new fooVM();
f.bar(2); // causes a PUT to /api/v1/foo/
View dashboard.js
1 2 3 4 5 6 7 8
define(['ko','ko.mapping','underscore','moment'],
function(ko,mapping,_,moment) {
console.log('dashboard VM loaded:',arguments);
 
return function(){
var self = this;
};
});
View gist:5027698
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/python
 
# don't forget each model needs
# class Meta:
# app_label = 'app_name' # or whatever the app name is
 
PACKAGE = 'project_name.app_name.models' # <--- SET YOUR PACKAGE NAME
 
 
import os
View gist:4962327
1 2 3 4 5 6 7 8 9 10
from django.conf import settings
 
def email_template(
template_name = None,
template_context = None,
subject = '',
recipients = None,
sender = settings.DEFAULT_FROM_EMAIL,
fail_silently = False,
use_markdown = False,
Something went wrong with that request. Please try again.