Skip to content

Instantly share code, notes, and snippets.


Niall O'Brien niallobrien

  • Waterford, Ireland
View GitHub Profile
niallobrien / gist:3859740
Created Oct 9, 2012
Laravel & Bootstrap ajax modal example
View gist:3859740
// html
<div>This is my post</div>
<!-- Just put this div at the bottom of your template somewhere-->
<!-- Notice that its hidden by default, so if it doesnt get used, thats fine-->
<div class="modal hide"></div>
type: 'post', // or post?
niallobrien / gist:4110854
Created Nov 19, 2012
OSX Well for Bootstrap
View gist:4110854
.well {
border: 1px solid #ccc;
.border-radius(6px 6px 0 0);
.box-shadow(0px 0px 0px 1px #eee);
header {
.border-radius(6px 6px 0 0);
#gradient > .vertical(@navbarBackground, #ddd );
margin: -19px -19px 20px -19px;
border-bottom: 1px solid #ccc;
padding: 10px;
niallobrien / cascading-deletes.php
Last active Dec 14, 2015
Cascading deletes in Laravel 4.
View cascading-deletes.php
// I have Groups. A group can have many discussions. A single discussion can have many posts.
// models/Group.php
public function delete()
// Check for discussions belonging to the group first
if ($this->discussions) {
foreach ($this->discussions as $discussion) {
niallobrien / gist:5098578
Last active Jan 12, 2016
Laravel 4 install & update process
View gist:5098578
// Clone L4 repo
git clone -b develop git:// myapp
cd myapp
// Install Composer
curl -sS | php
php composer.phar install
// Rename origin
git remote rename origin upstream
niallobrien / gist:5308804
Last active Dec 15, 2015
100% height sidebar
View gist:5308804
position: absolute; top:0; bottom:0;
niallobrien / gist:5405135
Created Apr 17, 2013
Install Ruby & Rails
View gist:5405135
git clone git:// ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL -l
git clone git:// ~/.rbenv/plugins/ruby-build
rbenv install 2.0.0-p0
git clone ~/.rbenv/plugins/rbenv-gem-rehash
rbenv rehash
rbenv global 2.0.0-p0
gem install rails --no-ri --no-rdoc
niallobrien / gist:5669430
Last active Dec 17, 2015
PHP simple IoC example
View gist:5669430
class Container
protected $registry = [];
// Typehint Closure to show expected object
public function bind($name, Closure $closure)
// Populate $registry array with passed-in $closure
$registry[$name] = $closure;
niallobrien / gist:5669865
Created May 29, 2013
PHP OOP, implementing and interface & dependancy injection.
View gist:5669865
// Define the methods that must be implemented
interface MailerInterface
public function addEmail($email);
public function send();
// Implement the Interface methods in this class
niallobrien / Gruntfile.js
Last active Dec 24, 2015
Yeoman + Angular + Bootstrap v3
View Gruntfile.js
// Generated on 2013-10-02 using generator-angular 0.4.0
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT });
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
// # Globbing
// for performance reasons we're only matching one level down:
niallobrien / 0_reuse_code.js
Created Oct 4, 2013
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console