Skip to content

Instantly share code, notes, and snippets.

View dhrrgn's full-sized avatar
🦙

Dan Horrigan dhrrgn

🦙
  • OH, USA
  • 13:52 (UTC -04:00)
View GitHub Profile
From da7ebd37ec8b22d45ef424ea31ab27d592e1734c Mon Sep 17 00:00:00 2001
From: Dan Horrigan <[email protected]>
Date: Fri, 21 Oct 2011 22:52:04 -0700
Subject: [PATCH] Updating .box
---
.box | 53 ++++++++++++++++++++++++++---------------------------
1 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/.box b/.box
@dhrrgn
dhrrgn / csrf.php
Created October 23, 2011 06:25
Simple, yet effective CSRF class for FuelPHP.
<?php
/**
* Simple, yet effective CSRF class for FuelPHP.
*
* @author Dan Horrigan
* @license MIT License
* @copyright 2011 Dan Horrigan
*/
/**
@dhrrgn
dhrrgn / data-markdown.user.js
Created November 8, 2011 19:10 — forked from paulirish/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
web1:
env_vars:
FUEL_ENV: production
TWITTER_CONSUMER_KEY: foooooobar
TWITTER_CONSUMER_SECRET: foooooobar
@dhrrgn
dhrrgn / module_generator.rb
Created October 24, 2012 20:56
Module Generator
class ModuleGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :module_name, :type => :string
def generate_module
apply_templates
end
private
<?php
$connection = Illuminate\Database\Connectors\ConnectionFactory::make([
'driver' => 'mysql',
'host' => '',
'database' => '',
'username' => '',
'password' => '',
'charset' => '',
'prefix' => '',
@dhrrgn
dhrrgn / Db.php
Created December 8, 2012 02:31
The Db file for easy use of the Database package from L4 outside of L4.
<?php
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\ConnectionResolver;
use Illuminate\Database\DatabaseManager;
class Db {
private static $resolver = null;
<?php
// App setup up here
$users_controller = new Controller\Users($app);
$app->get('/users', [$users_controller, 'get_index']);
$app->get('/users/:id', [$users_controller, 'get_index']);
$app->post('/users', [$users_controller, 'post_index']);
<?php
// Currently without `retry` construct
do {
$retry = false;
try {
// Do some stuff here
} catch (Exception $e) {
if ($can_i_fix_this) {
// Fix it
<?php
// Routing via subdomain:
Route::get('foo', 'SomeController@foo')->setHostnamePattern('some.sub.domain.com');