Skip to content

Instantly share code, notes, and snippets.

@jbottigliero
jbottigliero / sublime.sh
Created April 7, 2012 23:00
Simple shell script to quickly open projects in Sublime Text 2
#! /bin/bash
# The location of Sublime Text 2 application
# The default path to be used when opening projects
DEFAULT_PATH="/Applications/MAMP/htdocs/"
# The project to open
project=$1
@jbottigliero
jbottigliero / MY_Form_validation.php
Created April 12, 2012 05:10
(set_rules method) Add support for 'flash error messages' to CodeIgniter's built in Form Validation library.
<?php
class MY_Form_validation extends CI_Form_validation {
// --------------------------------------------------------------------
/**
* Set Rules
*
* This function takes an array of field names, validation
@jbottigliero
jbottigliero / MY_Form_validation.php
Created April 12, 2012 06:21
(set_messages method) Add support for 'flash error messages' to CodeIgniter's built in Form Validation library.
<?php
class MY_Form_validation extends CI_Form_validation {
public function set_message($lang, $val = '', $name = FALSE)
{
if($name !== FALSE){
$lang = $name.'.'.$lang;
}
@jbottigliero
jbottigliero / toggleDisabled.html
Created April 30, 2012 19:58
jQuery Toggle Disabled
<input id="test_input" type="text" value=""/>
<button id="disabler">Disable Input</button>
<script>
$('#disabler').on('click', function(){
// No callback
// $('#test_input').toggleDisabled();
// With callback
$('#test_input').toggleDisabled(function(el, disabled){
@jbottigliero
jbottigliero / MY_URI.php
Created June 5, 2012 16:37
CodeIgniter URI Library: Add offset functionality to the `uri_string` method.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
@jbottigliero
jbottigliero / gist:2876556
Created June 5, 2012 17:54
CodeIgniter Pagination Library: Add ability to wrap `digits` with HTML markup.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
@jbottigliero
jbottigliero / .directions
Created June 28, 2012 21:46
MAMP : Virtual Hosts
# Backup your host file
sudo cp /etc/hosts /etc/hosts.bak
# Edit your host file
# See 'hosts.example' for example contents
vim /etc/hosts
# Edit MAMP Apache configuration to include Virtual Hosts configuration
@jbottigliero
jbottigliero / gist:3955492
Created October 25, 2012 21:20
ejabber, BOSH, and StopheJS, Oh My(SQL)

ejabberd

####Server Ubuntu 10.04 LTS Lucid

##Process

Install ejabberd

@jbottigliero
jbottigliero / crontaber
Created February 11, 2013 22:05
Add jobs to crontab quickly via CLI
job="@daily which node" && cat <(grep -v "$job" <(crontab -l)) <(echo "$job") | crontab -
@jbottigliero
jbottigliero / geo.js
Created February 18, 2013 17:16
node.js geo data. Initially populated via [Graphic Maniacs](http://graphicmaniacs.com/note/php-countries-array-us-states-array/)
var countries = {
AF: "Afghanistan",
AL: "Albania",
DZ: "Algeria",
AS: "American Samoa",
AD: "Andorra",
AO: "Angola",
AI: "Anguilla",
AQ: "Antarctica",
AG: "Antigua and Barbuda",