Skip to content

Instantly share code, notes, and snippets.

View ericlbarnes's full-sized avatar
🎵
git push it, git push it real good

Eric Barnes ericlbarnes

🎵
git push it, git push it real good
View GitHub Profile
@ericlbarnes
ericlbarnes / example.php
Created March 14, 2013 17:36
How I imagine composer.phar code.
echo "Loading composer repositories with package information";
echo "Updating dependencies";
sleep(9999999999);
.....
@ericlbarnes
ericlbarnes / gist:5423104
Last active December 16, 2015 10:49
Favorite Aspects of Laravel
I am curious on what is your favorite aspects to Laravel compared to other frameworks? If
you are trying to sell Laravel to another dev what would be your selling points?
@ericlbarnes
ericlbarnes / foreach_limit.blade.php
Last active July 13, 2023 07:51
Limit a foreach with Laravel blade
@foreach (array_slice($posts->toArray(), 0, 5) as $post)
<h1>{{ $post['title'] }}</h1>
@endforeach
this.selectize = this.$("#js-tags").selectize({
persist: true,
maxItems: null,
valueField: "tag",
labelField: "tag",
searchField: ["tag"],
options: tags.toJSON(), // Backbone collection
render: {
item: function(item) {
return "<div><i class='icon-tag'></i> " + item.tag + "</div>";
@ericlbarnes
ericlbarnes / filters.php
Created July 16, 2013 17:30 — forked from anonymous/filters.php
Laravel CSRF Ajax
/**
* Filter to check for CSRF attacks from the ajax requests.
*/
Route::filter('csrf_header', function()
{
if (Session::token() != Request::header('x-csrf-token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
@ericlbarnes
ericlbarnes / helpers.php
Created September 4, 2013 13:04
Laravel hidden helpers
// DB Dumpers
DB::listen(function($sql)
{
var_dump($sql);
});
Event::listen('laravel.query', function($sql)
{
var_dump($sql);
# easy installation:
# brew install python
# sudo easy_install pip # PIP is recommended for installation
# sudo -s # Creates a new sudo shell
# export ARCHFLAGS="-arch i386 -arch x86_64" # Need to set some GCC flags
# exit
# sudo pip install fabric # Get the install on
# sudo pip install python-simple-hipchat
import os, getpass, random, hipchat
@ericlbarnes
ericlbarnes / Vagrantfile
Last active January 8, 2016 00:32
vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 5432, host: 54320
@ericlbarnes
ericlbarnes / vhost
Last active January 2, 2016 02:29
Statamic nginx
server {
access_log /home/webroots/default/logs/access.log;
error_log /home/webroots/default/logs/error.log;
root /home/webroots/default/public_html;
index index.php;
# Make site accessible from http://localhost/
server_name localhost;
@ericlbarnes
ericlbarnes / postInterface.php
Created January 22, 2014 16:22
Which one is better?
interface PostRepositoryInterface {
public function create($title, $content, $slug, array $meta, array $tags, $active, $user_id, Carbon $publish_date);
}
interface PostRepositoryInterface {
public function create(array $data);
}