Skip to content

Instantly share code, notes, and snippets.

View brennen's full-sized avatar

Brennen Bearnes brennen

View GitHub Profile
@brennen
brennen / anagrams.PL
Created March 9, 2010 06:22
anagrams.pl
#!/usr/bin/perl
use strict;
use warnings;
use 5.10.0;
# attempt to determine if two strings are anagrams
my (@first) = split //, 'brennen';
my (@second) = split //, 'bernnen';
<?php
class foo {
function __construct ($arg) {
echo $arg;
}
}
class bar extends foo {
}
brennen@catastrophe:/usr/share/xsessions$ cat xmonad.desktop
[Desktop Entry]
Encoding=UTF-8
Name=XMonad
Comment=Lightweight tiling window manager
Exec=xmonad.start
Icon=xmonad.png
Type=XSession
brennen@catastrophe:/usr/share/xsessions$ cd /usr/local/bin/
brennen@catastrophe:/usr/local/bin$ ls -lh
@brennen
brennen / event_catcher.php
Created November 15, 2011 22:38
Some kind of thing that does things with things.
<?php
namespace bpb;
$events = array(
array(
'name' => 'brennen',
'dog' => 'silent'
),
array(
'name' => 'suzy',
@brennen
brennen / .vimrc
Created December 13, 2011 07:53 — forked from averyvery/.vimrc
Tweaked Vim minimap
function! ToggleMinimap()
if exists("s:isMini") && s:isMini == 0
let s:isMini = 1
else
let s:isMini = 0
end
if (s:isMini == 0)
@brennen
brennen / BangOpen.vim
Created October 1, 2015 19:26 — forked from thcipriani/BangOpen.vim
Open the output of a command as a file in a new tab: i.e. :BangOpen which git-new-workdir
" BangOpen ------------------------------------------------------------ {{{
function! BangOpen(arg)
execute 'tabe ' . system(a:arg)
endfunction
command! -nargs=1 BangOpen :call BangOpen(<f-args>)
" }}}
@brennen
brennen / commits.txt
Created April 25, 2012 21:35
commit frequency by hour
brennen@brennen-dev 15:13:09 /var/www (master) $ cat ~/commit_dates | perl ~/commit_dates.pl | sort | uniq -c
88 00
46 01
18 02
5 03
4 04
6 05
7 06
18 07
117 08
@brennen
brennen / getProperty.php
Created May 25, 2012 03:23
fedex sadness
<?php
/**
* This section provides a convenient place to setup many commonly used variables
* needed for the php sample code to function.
*/
function getProperty($var){
if($var == 'check') Return true;
if($var == 'shipaccount') Return 'XXX';
if($var == 'billaccount') Return 'XXX';
@brennen
brennen / gist:3940014
Created October 23, 2012 16:47 — forked from sipple/gist:3939944
Time validation
<script type="text/javascript">
jQuery(document).ready(function($){
$('.datepicker').datepicker({ changeMonth: true, changeYear: true, minDate: '-1y', maxDate: '+3y'});
$.validator.addMethod("time", function(value, element) {
return this.optional(element) || /^(([0-1]?[0-2])|([2][0-3])):([0-5]?[0-9])(a|p)m?$/i.test(value);
}, "Please enter a valid time.");
$("#post").validate({
rules: {
time: "required time"
@brennen
brennen / whitespace.php
Created October 29, 2012 19:40
a rough breakdown of how i approach php whitespace, for stilldavid
<?php
// i used to always indent after the opening php tag, but i've decided that's
// kind of silly for non-template stuff.
// general stuff:
// - 2 space indents, no tab characters.
// - i think whitespace contributes to readability, and code that is
// crammed into the least space possible often strikes me as harder
// to follow.
// - i like to align like things vertically.