Skip to content

Instantly share code, notes, and snippets.

@dazld
dazld / loader.js
Created February 20, 2012 19:16
ICH Template Loading
loadTemplate: function(file,callback){
var that = this;
var partial = false;
if (file.indexOf('partial') !== -1) {
partial = true;
};
$.post('templates/'+file+'.tpl',function(e){
var s = document.createElement('script');
s.setAttribute('id',file);
@dazld
dazld / site.validate.js
Created March 23, 2012 13:54
Basic JS Validation
if (!site || typeof(site) !== 'object') {
var site = {};
};
site.validate = {
init: function(){
// bind all buttons to form validation and submission
this.bindSubmits(false);
if ($('form[fact]').length == 1) {
$('form[fact] input:visible:first').focus();
@dazld
dazld / perlin.php
Created March 23, 2012 18:59
PHP Perlin Noise Class
//This is a port of Ken Perlin's "Improved Noise"
// http://mrl.nyu.edu/~perlin/noise/
// Originally from http://therandomuniverse.blogspot.com/2007/01/perlin-noise-your-new-best-friend.html
// but the site appears to be down, so here is a mirror of it
class Perlin {
var $p, $permutation, $seed;
var $_default_size = 64;
@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 April 2, 2012 09:45
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow) no-repeat ;
min-height: 100%;
font-family: "Lato";
}
h1 {
@dazld
dazld / dabblet.css
Created April 4, 2012 21:58
CSS callouts
/**
* CSS callouts
*/
#frame {
width: 300px;
padding: 12px;
margin: 0 auto;
margin-top: 12px;
border: 1px solid #ccc;
font-size: 14px;
@dazld
dazld / dabblet.css
Created April 4, 2012 22:29
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow) no-repeat ;
min-height: 100%;
font-family: "Lato";
}
h1 {
@dazld
dazld / acl.php
Created April 11, 2012 15:08
Codeigniter (very basic) ACL
<?php
/**
*
*/
class Acl extends CI_Model
{
protected $actions = array();
body {
width: 580px;
margin: 0 auto;
font-family: sans-serif;
font-size: 12px;
color: #666;
}
.fan {
position: relative;
width: 120px;