This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Base config | |
basedir = '/Users/YOURUSERNAME/' | |
user = 'YOURUSERNAME' | |
# Setup User | |
import pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set input-meta on | |
set output-meta on | |
set convert-meta off | |
set completion-query-items 10000 | |
set completion-ignore-case On | |
# these allow you to use shift+left/right arrow keys | |
# to jump the cursor over words | |
"\e[1;2C": forward-word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LogFormat "%h %l %u %t \"%m http://%{Host}i%U %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" hostnames | |
CustomLog "/private/var/log/apache2/access_log" hostnames |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from decimal import * | |
getcontext().prec = 6 | |
cols = Decimal(24) | |
col_size = Decimal(6) # columns should be this many units | |
gutter = Decimal(1) # with a 1 unit gutter on either side | |
total_width = Decimal(100) | |
units = '%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin\Libraries; | |
use \Config; | |
use \DateTime; | |
use \DB; | |
use \Exception; | |
use Admin\Libraries\Fields\Field; | |
class ModelHelper { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function friday(e) { | |
if(e) { | |
// Not doin' nothin', it's Friday. | |
e.preventDefault(); | |
} | |
/************$~I**************************Z********************************* | |
***********O,7.++O$+********************O,..ZI****************************** | |
***********$..$.78.$******************$...7+. ~Z*******************+******** | |
***********.Z.~.7D.O****************O,...,+. ....+Z*************7O+77I*+**** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In your init: | |
/* Handlebars doesn't have the basics. */ | |
Handlebars.registerHelper('ifEq', function(v1, v2, options) { | |
if(v1 == v2) { | |
return options.fn(this); | |
} | |
return options.inverse(this); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION merge_kvstore(dkey character varying, ddata BYTEA) RETURNS VOID AS | |
$$ | |
BEGIN | |
LOOP | |
-- first try to update the key | |
UPDATE kvstore SET value = ddata WHERE key = dkey; | |
IF found THEN | |
RETURN; | |
END IF; | |
-- not there, so try to insert the key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_top_level_page() { | |
global $top_level_page; | |
global $post; | |
// Get global page heading | |
if( is_page() && !$top_level_page) { | |
/* Get an array of Ancestors and Parents if they exist */ | |
$parents = get_post_ancestors( $post->ID ); | |
/* Get the top Level page->ID count base 1, array base 0 so -1 */ | |
if($parents) { | |
$id = $parents[count($parents)-1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Translate a non-standard object into an associative array object. | |
* Super-useful for dealing with simplexml objects. | |
*/ | |
function simpleXML_to_object($obj) | |
{ | |
$data = new StdClass(); | |
if( | |
(is_object($obj) && get_class($obj) == 'SimpleXMLElement') |