Skip to content

Instantly share code, notes, and snippets.

View bkozora's full-sized avatar

Bobby Kozora bkozora

  • Philly
View GitHub Profile
@bkozora
bkozora / git-ignore.large.files
Created September 12, 2011 18:03
git Ignore by Filesize
find . -size +1G | cat >> .gitignore
@bkozora
bkozora / 0_reuse_code.js
Created January 25, 2014 19:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
git config --global merge.tool diffconflicts git config --global mergetool.diffconflicts.cmd 'diffconflicts vim $BASE $LOCAL $REMOTE $MERGED' git config --global mergetool.diffconflicts.trustExitCode true git config --global mergetool.diffconflicts.keepBackup false
@bkozora
bkozora / kohana.database.insert.php
Last active August 29, 2015 14:07
Kohana Database Class Examples
<?php
// How to insert using Kohana's Database class. Always forget the syntax...
$result = DB::insert('table', array('field1', 'field2', 'field3'))
->values(array('value1', 'value2', 'value3'))
->execute();
@bkozora
bkozora / db.conn.php
Created October 28, 2014 15:49
Failsafe Production Database Connection
<?php
$useDevDb = false;
if (isset($_SERVER['ENVIRONMENT']) && $_SERVER['ENVIRONMENT'] == 'PRODUCTION') {
$useDevDB = false;
} elseif ((isset($_SERVER['ENVIRONMENT']))
&& $_SERVER['ENVIRONMENT'] == 'DEVELOPMENT'
|| $_SERVER['ENVIRONMENT'] == 'BETA') {
@bkozora
bkozora / occurrences
Created November 14, 2014 16:07
Find all occurrences of a pattern in Vim
%s/pattern-here//gn
@bkozora
bkozora / Recursive PHP Lint
Created November 14, 2014 18:02
Lints all PHP files recursively from a starting directory
find ./ -type f -name \*.php -exec php -l {} \; | grep "Errors parsing ";
@bkozora
bkozora / gist:f5612ba9d8080f6b53b1
Created January 5, 2015 15:31
Laravel - Define Layout on a Controller
class UserController extends BaseController {
/**
* The layout that should be used for responses.
*/
protected $layout = 'layouts.master';
/**
* Show the user profile.
*/
@bkozora
bkozora / gist:6fb94f1c0955a528a3cd
Created January 5, 2015 15:32
Blade - Define a Layout
<!-- Stored in app/views/layouts/master.blade.php -->
<html>
<body>
@section('sidebar')
This is the master sidebar.
@show
<div class="container">
@yield('content')
@bkozora
bkozora / blade-loops.html
Created January 5, 2015 15:33
Blade - Loops
@for ($i = 0; $i < 10; $i++)
The current value is {{ $i }}
@endfor
@foreach ($users as $user)
<p>This is user {{ $user->id }}</p>
@endforeach
@forelse($users as $user)
<li>{{ $user->name }}</li>