Skip to content

Instantly share code, notes, and snippets.

ando dre1080

Block or report user

Report or block dre1080

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Twitter User Object MySQL Schema.sql
CREATE TABLE `user` (
`twitter_id` int(10) unsigned NOT NULL,
`name` varchar(140) NOT NULL,
`screen_name` varchar(30) NOT NULL,
`location` varchar(180) default NULL,
`description` varchar(300) default NULL,
`profile_image_url` varchar(400) NOT NULL,
`url` varchar(400) default NULL,
`protected` varchar(5) default NULL,
`followers_count` int(10) unsigned NOT NULL,
@dre1080
dre1080 / gist:988488
Created May 24, 2011
Simple ini parser
View gist:988488
$debug = function($var, $exit = true) {
echo '<pre>';
(is_array($var) || is_object($var)) ? print_r($var) : var_dump($var);
echo '</pre>';
if ($exit)
exit;
};
$parse = function($file, $show_debug = false) use ($debug) {
@dre1080
dre1080 / csrf.php
Created Oct 26, 2011 — forked from dhrrgn/csrf.php
Simple, yet effective CSRF class for FuelPHP.
View csrf.php
<?php
/**
* Simple, yet effective CSRF class for FuelPHP.
*
* @author Dan Horrigan
* @license MIT License
* @copyright 2011 Dan Horrigan
*/
/**
@dre1080
dre1080 / async_iteration.js
Created Feb 20, 2012
Everything in node happens at the same time, which means, unless you're doing your processing inside your callbacks, you cannot guarantee asynchronous functions have completed yet.
View async_iteration.js
/**
* Source: http://stackoverflow.com/questions/6287908/nodejs-express-fs-iterating-files-into-array-or-object-failing
*/
var fs = require('fs'),
EventEmitter = require('events').EventEmitter,
filesEmitter = new EventEmitter(),
files = [];
// this event will be called when all files have been added to the files array
@dre1080
dre1080 / gist:2267982
Created Mar 31, 2012 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide
View gist:2267982

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@dre1080
dre1080 / haproxy.cnf
Created Apr 4, 2012 — forked from asabirov/haproxy.cnf
Nginx, Faye, Node.js on 80 port
View haproxy.cnf
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
nbproc 1
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
@dre1080
dre1080 / haproxy.cnf
Created Apr 14, 2012 — forked from xeron/haproxy.cnf
haproxy.cnf
View haproxy.cnf
global
log 127.0.0.1 local0
log 127.0.0.1 local0 notice
maxconn 4096
nbproc 1
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
@dre1080
dre1080 / watch.sh
Created Apr 27, 2012
Compile and watch Sass (using Compass) and CoffeeScript files with one command
View watch.sh
#!/bin/bash
type -P compass &>/dev/null || { echo "Compass command not found."; exit 1; }
type -P coffee &>/dev/null || { echo "Coffee command not found."; exit 1; }
# Get current directory (project path)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SASS_DIR="$DIR/public/stylesheets/sass/"
CSS_DIR="$DIR/public/stylesheets/"
@dre1080
dre1080 / burp.md
Last active Oct 6, 2015
How to code drunk
View burp.md

How to code drunk

Some people born with it, some people are self-taught on this, some people just discover how. How about a guide on how to code great software while still drunk as a cow?

Rules

  • You can add your patterns by forking this gist.
  • You must be drunk before sending a pattern.
@dre1080
dre1080 / varbinary_migration_columns_initializer.rb
Created Aug 24, 2012
Setup varbinary columns or any other unsupported data type in rails migrations
View varbinary_migration_columns_initializer.rb
# Provide varbinary columns in a Migration.
# Probably a better way to do this?
#
# Usage:
# => t.varbinary :column, :limit => 20, ....[options]
#
ActiveRecord::ConnectionAdapters::SchemaStatements.module_eval do
def type_to_sql_with_varbinary(type, limit = nil, precision = nil, scale = nil)
return type_to_sql_without_varbinary(type, limit, precision, scale) unless :varbinary == type.to_sym
You can’t perform that action at this time.