Skip to content

Instantly share code, notes, and snippets.

@dazld
dazld / hierarchy.php
Created March 23, 2012 19:43 — forked from devi/hierarchy.php
MySQL "Closure Table" for CodeIgniter based on Bill Karwin design.
<?php
/**
*
* CI / MySQL Closure Table Model
*
* @link http://www.slideshare.net/billkarwin/models-for-hierarchical-data
* @TODO improve
*
* sql schema:
@dazld
dazld / jquery.jstree.js
Created March 27, 2012 14:30 — forked from rhsdev/jquery.jstree.js
Faster jstree
/*
* jsTree 1.0-rc3
* http://jstree.com/
*
* Copyright (c) 2010 Ivan Bozhanov (vakata.com)
*
* Licensed same as jquery - under the terms of either the MIT License or the GPL Version 2 License
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
@dazld
dazld / dabblet.css
Created May 2, 2012 11:58 — forked from anonymous/dabblet.css
Untitled
body {
width: 580px;
margin: 0 auto;
font-family: sans-serif;
font-size: 12px;
color: #666;
}
.fan {
position: relative;
width: 120px;
@dazld
dazld / dabblet.css
Created May 2, 2012 12:44 — forked from anonymous/dabblet.css
these rules only apply to first fan
body {
width: 580px;
margin: 0 auto;
font-family: sans-serif;
font-size: 12px;
color: #666;
}
.fan {
position: relative;
width: 120px;
@dazld
dazld / LICENSE.txt
Created July 6, 2012 10:09 — forked from tsaniel/LICENSE.txt
Konami Code easter egg
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
// In this example we'd like to have a factory that works per request and allows to keep track of created Models
// The singleton will however apply to all requests and thus keep growing
// For that reason we supply it with a reset function.
// This works fine until between receiving a request and sending a response there is no asynchronous code execution
// Once multiple requests come in in very short intervals, the asynchronous execution will lead to requests cross-polluting
// the singleton class
// factory.js
//
// Should be per-request so we can keep track
// In this example we'd like to have a factory that works per request and allows to keep track of created Models
// We create a factory per request and pass it around to the parts of the code that need access
// This can quickly lead to hard to messy code
// factory.js
//
// Basically a factory for factories
// For every request we create a new one
var Model = require('backbone').Model;
@dazld
dazld / _about.md
Last active December 21, 2015 03:08 — forked from TimBeyer/_working-using-domains.md
Working with Domains

Working with domains

@dazld
dazld / cls-example.js
Last active December 22, 2015 03:59 — forked from tooxie/cls-example.js
var local = require('./namespace-module');
var http = require('http');
var uuid = require('uuid').v4;
http.createServer(function(req, res) {
req._id = uuid();
local.run(function() {
local.set('id', req._id);
next(req, res);
@dazld
dazld / index.js
Last active December 22, 2015 17:38 — forked from othiym23/index.js
'use strict';
var assert = require('assert'),
director = require('director'),
EventEmitter = require('events').EventEmitter,
ns = require('continuation-local-storage').createNamespace('testing'),
express = require('express'),
app = express();