Skip to content

Instantly share code, notes, and snippets.

/*!
* $.preload() function for jQuery
* Preload images, CSS and JavaScript files without executing them
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/
* Demo: http://mathiasbynens.be/demo/javascript-preload
* Note that since this script relies on jQuery, the preloading process will not start until jQuery has finished loading.
*/
$.extend({
@badsyntax
badsyntax / build.sh
Created January 11, 2011 20:56
An example PHP & BASH Post-Receive github web hook to package projects
#! /usr/bin/env bash
#clone the repo
git clone -q "${1}" "clones/${2}"
cd "clones/${2}"
#update the submodules (how do we handle errors here?)
git submodule --quiet update --init --recursive
@badsyntax
badsyntax / gist:778734
Created January 13, 2011 22:20 — forked from k33g/gist:778460
function Human(){
var that = this;
var name="John Doe";
that.getName=function(){return name;}
that.setName=function(value){name=value;}
return that;
}
function Man(){
(function(d,c){d[c]=d[c].replace(/\bno-js\b/, "js");})(document.documentElement,"className");
// wha..whhaaat
// found in jquery source
var i =0;
for (; i < length;) {
if (callback.apply(object[i++], args) === false) {
break;
}
}
git init
git submodule add git://github.com/kohana/core.git system
git submodule add git://github.com/kohana/database.git modules/database
git submodule add git://github.com/kohana/userguide.git modules/userguide
git submodule add git://github.com/kohana/image.git modules/image
git submodule add git://github.com/kohana/codebench.git modules/codebench
git submodule add git://github.com/kohana/auth.git modules/auth
git submodule add git://github.com/kohana/pagination.git modules/pagination
git submodule add git://github.com/kohana/orm.git modules/orm
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Module_ModuleName extends Module {
public $version = '1.0';
public function info()
{
return array(
'name' => array(
@badsyntax
badsyntax / cssclean.html
Created March 28, 2011 17:01
Cleans your CSS - minifies to a human readable format
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSSClean</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style type="text/css">
body {
@badsyntax
badsyntax / editor_plugin.js
Created April 27, 2011 08:45
TinyMCE Highslide Inline Popups
/**
* @filename : editor_plugin.js
* @description : Highslide Inline Popups plugin to replace the default inlinepopups
* @developer : badsyntax (Richard Willis)
* @contact : http://badsyntax.co
* @demo : http://demos.badsyntax.co/tinymce-highslide-popups/
*/
(function() {
@badsyntax
badsyntax / imdb.php
Created May 28, 2011 22:53
Sort movie directories
<?php
if ($handle = opendir('.'))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != ".." && is_dir($file))
{
echo "Finding $file...";