Skip to content

Instantly share code, notes, and snippets.

View iloveitaly's full-sized avatar

Michael Bianco iloveitaly

View GitHub Profile
@iloveitaly
iloveitaly / DateRange.php
Created July 6, 2010 14:16
Easily format ranges of dates
<?php
/**
* @author Michael Bianco <http://mabblog.com>
*
**/
class DateRange {
public $start;
public $end;
@iloveitaly
iloveitaly / videobox.js
Created July 14, 2010 01:09
Videobox for MooTools 1.2.x
var Videobox = {
init: function (options) {
// init default options
this.options = Object.extend({
resizeDuration: 400, // Duration of height and width resizing (ms)
initialWidth: 250, // Initial width of the box (px)
initialHeight: 250, // Initial height of the box (px)
defaultWidth: 425, // Default width of the box (px)
defaultHeight: 350, // Default height of the box (px)
function isValidEmail(email) { return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email); }
var InputValidator = new Class({
options: {
errorColor: 'red',
errorClass: 'error_text',
ignoreDisabled: false,
auxElementPadding: '1em'
},
@iloveitaly
iloveitaly / mselect.php
Created September 15, 2010 15:27
Formo 1.1.x multiple select driver
<?php defined('SYSPATH') or die('No direct script access.');
Formo::include_file('driver', 'select');
class Formo_mselect_Driver extends Formo_select_Driver {
public $selected_values = array();
public function __construct($name='',$info=array()) {
parent::__construct($name,$info);
@iloveitaly
iloveitaly / compile.bash
Created October 14, 2010 20:31
Combine & compress multiple css / js files
#!/bin/bash
# move to the directory which the script is placed in
# all file refences will be based off this location
cd `dirname $0`
# == Configuration Options ==
CSS_OUTPUT_FILE='css/core.css'
JS_OUTPUT_FILE='js/core.js'
@iloveitaly
iloveitaly / datepicker.js
Created October 20, 2010 17:54
Modification of the mootools datepicker to normalize input / output unix dates as UTC
/**
* datepicker.js - MooTools Datepicker class
* @version 1.16
*
* by MonkeyPhysics.com
*
* Source/Documentation available at:
* http://www.monkeyphysics.com/mootools/script/2/datepicker
*
* --
// $Id: plugin.js,v 1.5 2010/07/13 17:04:30 anrikun Exp $
/**
* @file
* Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr>
* http://www.absyx.fr
*
* Portions of code:
* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
@iloveitaly
iloveitaly / epub-fix-cover.bash
Created January 14, 2011 16:16
Fixes the cover page for ePubs created by indesign
#!/bin/bash
# Author: Michael Bianco <http://mabblog.com/>
# Adds css width to the cover page, links the cover image on the cover page to a metadata tag
# Properly handles the mimetype on recompression
# This allows a ePub generated by InDesign to properly display the cover image on iBooks when the ePub is NOT distributed via the iBooks store
# xml compression info from: http://www.mobileread.com/forums/showthread.php?t=55681
@iloveitaly
iloveitaly / compress.bash
Created February 22, 2011 01:10
Compress css + js files
compress_web_files() {
JS_OUTPUT_FILE=$1
CSS_OUTPUT_FILE=$2
JAVASCRIPT_FILES=$3
CSS_FILES=$4
generate_js_include() {
echo "document.write('<script src=\"/includes/$1\" type=\"text/javascript\" charset=\"utf-8\"></script>');"
}
@iloveitaly
iloveitaly / AMURLLoader.h
Created May 7, 2011 16:24
Modification of AMURLLoader to include a -cancel method
//
// AMURLLoader.h
// FavIconTest
//
// Created by Andreas on 13.09.04.
// Copyright 2004 Andreas Mayer. All rights reserved.
//
// 2004-11-23 Andreas Mayer
// - added delegate
// - init/loaderWithURL will no longer call load automatically