Skip to content

Instantly share code, notes, and snippets.

// instantiate like
// var images = new imagePreloader('/path/to/image1.jpg', '/path/to/image2.jpg', ...);
var imagePreloader = function() {
var _this = this;
_this.cache = {};
_this.load = function(src, callback) {
var cacheImage = document.createElement('img');
cacheImage.src = src;
git_prompt() {
unset __CURRENT_GIT_BRANCH
unset __CURRENT_GIT_BRANCH_STATUS
unset __CURRENT_GIT_BRANCH_IS_DIRTY
local st="$(git status 2>/dev/null)"
if [[ -n "$st" ]]; then
local -a arr
arr=(${(f)st})
<?php
function objectsIntoArray($arrObjData, $arrSkipIndices = array()) {
$arrData = array();
if (is_object($arrObjData)) {
$arrObjData = get_object_vars($arrObjData);
}
if (is_array($arrObjData)) {
$.fn.selectReplace = function() {
if (!($.browser.msie && $.browser.version < 7)) {
return this.each(function() {
var $this = $(this);
$this.wrap('<span id="' + $this.attr('id') + '_wrapper" class="select_wrapper"></span>')
.before('<span>' + $this.find('option[value=' + $this.val() + ']').html() + '</span>')
.css("opacity", 0)
.change(function() {
$this.parent().find('span').html($this.find('option[value=' + $this.val() + ']').html());
CPB.module = function() {};
CPB.module.prototype.constructor = CPB.module;
CPB.module.prototype.reload = function(event, data) {
var module = this;
module.lastUpdate = CPB.timestamp();
module.path = data.path;
CPB.dispatcher.process(data.path, function(data) {
module.render(module.view.reload, data[module.shortName]);
});
module.lastUpdate = CPB.timestamp();
div.page {
background: -webkit-gradient(linear, left bottom, left top, color-stop(0.56, rgba(0,0,0,1)), color-stop(0.12, rgba(0,0,0,0.85)));
height: 1008px;
padding-top: 16px;
position: relative;
width: 768px;
}
#header {
background: -webkit-gradient(
// jquery select replace
$.fn.selectReplace = function(options) {
if (!($.browser.msie && $.browser.version < 7)) {
var opts = $.extend({}, $.fn.selectReplace.defaults, options);
return this.each(function() {
var $this = $(this);
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
$this.change(function() {
@markupboy
markupboy / html5video.sh
Created February 8, 2011 15:43
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
####################################
# Output file for HTML5 video #
# Requirements: #
# - handbrakecli #
# - ffmpeg #
# - ffmpeg2theora #
# #
# usage: #