Skip to content

Instantly share code, notes, and snippets.

View orther's full-sized avatar
🏠
Working from home

Brandon Orther orther

🏠
Working from home
View GitHub Profile
@orther
orther / mad-jobs.sh
Created April 9, 2014 09:04
Linux jobs command for parallel processing
# Wait on all child jobs.
function wait_jobs () {
for PID in $(jobs -p); do
notice "Waiting on pid $PID"
wait $PID
done
}
"-------------------------------------------------------------------------------
" Vim Initial Setup
"-------------------------------------------------------------------------------
" init vim-pathogen
execute pathogen#infect()
set nocompatible
filetype off
@orther
orther / pip_with_pythonpath
Created March 8, 2013 05:49
-- `pip` for my restricted user This script runs `pip` located in $PYTHONPATH with -t (target dir) set as $PYTHONPATH
#!/bin/bash
PIP="$PYTHONPATH/pip $1"
# add target dir for install and uninstall
[[ "$1" = *install ]] && PIP="$PIP -t $PYTHONPATH"
# remove first arg since it is in $PIP
shift
@orther
orther / fizzbuzz.py
Created April 11, 2012 17:02
FizzBuzz
def fuzz_bizz (start, finish, fizz_denominator=3, buzz_denominator=5):
for i in range(start, finish+1):
output = ''
if i % fizz_denominator is 0:
output += "Fizz"
if i % buzz_denominator is 0:
output += "Buzz"
if output is '':
server {
   listen      8118;
   server_name website.com www.website.com;
   root        /var/www/website/www;
   expires 1M;
   # route requests to front controller
   location / {
       rewrite ^(.+)$ /index.php?__rlquery=$uri last;
diff --git a/lib/elements/model/database.py b/lib/elements/model/database.py
index a563906..87b9094 100644
--- a/lib/elements/model/database.py
+++ b/lib/elements/model/database.py
@@ -538,11 +538,16 @@ class DatabaseModel:
if key == meta.primary_key or key in meta.model.Meta.read_only:
continue
+ if key == "key":
+ key = "`key`"
@orther
orther / MusicSearch.php
Created December 3, 2011 19:43
PHP example of using class constants for well defined and easily maintained options.
<?php
class MusicSearch {
// -----------------------------------------------------------------------------------------------------------------
// CONSTANTS
// -----------------------------------------------------------------------------------------------------------------
// categories options
const CATEGORY_ALBUM = 1;
@orther
orther / swap_window_buffer.vim
Created April 12, 2011 22:28
vim script that allows you to easily swap window buffers between windows(splits)
" Swap window buffers.
function! SwapWindowBuffers()
if !exists("g:markedWinNum")
" set window marked for swap
let g:markedWinNum = winnr()
:echo "window marked for swap"
else
" mark destination
let curNum = winnr()
let curBuf = bufnr( "%" )
-- Function: update_article_fts_index()
-- DROP FUNCTION update_article_fts_index();
CREATE OR REPLACE FUNCTION update_article_fts_index()
RETURNS trigger AS
$BODY$
BEGIN
-- Update the fts_index
NEW.fts_index =
@orther
orther / window_buffer_swap.vim
Created April 5, 2011 23:13
Vim script to allow you to swap window buffers easily
" Swap window buffers.
function! SwapWindowBuffers()
if !exists("g:markedWinNum")
" set window marked for swap
let g:markedWinNum = winnr()
:echo "window marked for swap"
else
" mark destination
let curNum = winnr()
let curBuf = bufnr( "%" )