Skip to content

Instantly share code, notes, and snippets.

@MalucoMarinero
MalucoMarinero / trace.txt
Created August 1, 2012 00:13
Haystack Error Stacktrace
Traceback (most recent call last):
File "/srv/ss/repo/src/.production_env/local/lib/python2.7/site-packages/Django-1.4.1-py2.7.egg/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/srv/ss/repo/src/.production_env/local/lib/python2.7/site-packages/Django-1.4.1-py2.7.egg/django/core/handlers/base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/srv/ss/repo/src/.production_env/local/lib/python2.7/site-packages/Django-1.4.1-py2.7.egg/django/core/handlers/base.py", line 224, in handle_uncaught_exception
if resolver.urlconf_module is None:
File "/srv/ss/repo/src/.production_env/local/lib/python2.7/site-packages/Django-1.4.1-py2.7.egg/django/core/urlresolvers.py", line 323, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/srv/ss/repo/src/.production_env/local/lib/python2.7/site-packages/Django-1.4.1-py2.7.egg/django/utils/importlib.py", line 35, i
@MalucoMarinero
MalucoMarinero / GruntFile.coffee
Created April 27, 2013 16:24
Create a javascript loader for your application, that won't require you to change the html come deployment.
fs = require 'fs'
path = require 'path'
mm = require 'minimatch'
wrench = require 'wrench'
coffee = require 'coffee-script'
module.exports = (grunt) ->
grunt.initConfig {
loader:
desktopClient:
window.db = new JohoDB "testDB", 20
db.addSchema 'Household', {
id: {type: "int", primaryKey: true, autoIncrement: true}
address: {type: "string", required: true}
suburb: {type: "string", required: true}
postCode: {type: "string", required: true}
}
db.addSchema 'People', {
@MalucoMarinero
MalucoMarinero / gist:5499229
Last active December 16, 2015 21:21
Early API for a client database abstraction I'm writing, taking cues from the way Django's ORM works.
# Start a new database with name "testDB" and version 20
window.db = new JohoDB "testDB", 20
# Define the database schema, early days so the relations don't do anything yet, but I'm getting there.
db.addSchema 'Household', {
id: {type: "int", primaryKey: true, autoIncrement: true}
address: {type: "string", required: true}
suburb: {type: "string", required: true}
window.db = new JohoDB "testDB", 20
db.addSchema 'Household', {
id: {type: "string", primaryKey: true, autoHash: true}
address: {type: "string", required: true}
suburb: {type: "string", required: true}
postCode: {type: "string", required: true}
}
db.addSchema 'People', {
@MalucoMarinero
MalucoMarinero / gist:5519900
Created May 5, 2013 06:02
Many To Many Relations now in place, you can update relationships with the save option {updateRelationships: true}, which will check for an array or an object. You can save the changes on those related objects by instead using {updateRelatedObjs: true}.
window.db = new JohoDB "testDB", 20
db.addSchema 'Household', {
id: {type: "string", primaryKey: true, autoHash: true}
address: {type: "string", required: true}
suburb: {type: "string", required: true}
postCode: {type: "string", required: true}
}
db.addSchema 'People', {
@MalucoMarinero
MalucoMarinero / gist:9797472
Last active August 29, 2015 13:57
Fat Frontend
So, I'm gonna make a book. It's gonna start off as a document in sphinx-doc, so I just
publish as a flat file HTML, and then maybe figure out funding it if there's enough
interest in the output. The subject of the book would be an open source project that can
be completely viewed on it's own, and the idea is that the book would go through the
technologies involved, the decision process, and how it's all structured together to
build a self sufficient Frontend client.
Key ideas are a structure of modular components, that means when you end up with shit
going out of date, you don't have to change everything to adapt. Give new technology
import Introspect = require('../../utils/Introspect');
var updateAttr = Introspect.updateAttr;
var addToUpdate = Introspect.addToUpdate;
var getAttr = Introspect.getAttr;
var FormStateView = React.createClass({
mixins: [FormMixin],
getInitialState: function() {
return {
@MalucoMarinero
MalucoMarinero / ReactComponentUnitTest.ts
Created July 5, 2014 23:51
Testing React with Generative Testing
///<reference path="../typedefs/node.d.ts"/>
///<reference path="../typedefs/bluebird.d.ts"/>
///<reference path="../typedefs/lodash.d.ts"/>
declare var describe, it, before; // Mocha injections.
import SwiftCheck = require('../src/SwiftCheck');
var domino = require('domino');
// DOM must be created prior to including React
global.window = domino.createWindow("<html><head></head><body></body></html>");
@MalucoMarinero
MalucoMarinero / ie8bgpolyfill.coffee
Created December 26, 2014 00:29
PostCSS - IE8 RGBA Background using Data URIs
postcss = require "postcss"
fs = require 'fs'
{Png} = require "png"
{Buffer} = require "buffer"
makePng = (r, g, b, a) ->
WIDTH = 64
HEIGHT = 64
alpha255 = 0xff * a