Skip to content

Instantly share code, notes, and snippets.

@krusynth
krusynth / StatusMessages.md
Last active December 26, 2015 18:49
A short summary of the format of Status Messages.

#Status Messages

Status messages should be sent first thing in the morning, before the developer begins work. They should list all projects that they're currently actively involved with, as well as any side items that need to be addressed. For all tasks that fall outside the scope of project work, or for direct feedback, a Housekeeping list item is recommended.

Messages should list the projects with their statuses at the top of each message. Underneath, include short descriptions of the status of each. The whole message should generally only be 5-10 sentences at most - be clear and to the point as much as possible. Make sure to list any items that are blocking you from completing work, and feel free to call out the responsible party.

Each project should list its status, from the following available options: OK (everything is fine and progressing normally), HOLD (waiting on something out of your control), WARNING (something has gone wrong here), DANGER (something has gone VERY wrong here), `F

@krusynth
krusynth / Maryland_g95-22F
Created October 11, 2013 13:47
Import file for Maryland
<?xml version="1.0" encoding="UTF-8"?>
<law>
<structure>
<unit label="article" identifier="g95" order_by="g95" level="1">g95</unit>
</structure>
<section_number>g95-22F</section_number>
<catch_line/>
<order_by>22F</order_by>
<text>
<section prefix="(a)">
@krusynth
krusynth / functions.php
Created September 4, 2013 14:53
Wordpress theme addition to add the page's slug, and the page's oldest ancestor's slug to the body class. Very useful for hierarchies.
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];
@krusynth
krusynth / merge_kvstore.psql
Created July 23, 2013 12:50
Function to emulate ON DUPLICATE KEY UPDATE functionality in Postgresql
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
@krusynth
krusynth / handlebars_comparison.js
Created April 28, 2013 15:17
Handlerbars.js doesn't have proper comparison operators. Also, accessing array indexes is weird.
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);
});
@krusynth
krusynth / friday.js
Last active December 16, 2015 17:00
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*+****
@krusynth
krusynth / ModelHelper.php
Created April 26, 2013 01:59
Fix for Laravel 3 Administrator when using database table prefixes
<?php
namespace Admin\Libraries;
use \Config;
use \DateTime;
use \DB;
use \Exception;
use Admin\Libraries\Fields\Field;
class ModelHelper {

Install NRPE and the necessary plugins.

CentOS/Fedora/RHEL

sudo yum install nrpe nagios-plugins nagios-plugins-all

Ubuntu/Debian

sudo apt-get install nagios-nrpe-server nagios-plugins

@krusynth
krusynth / grid.py
Created December 12, 2012 22:43
Make custom fluid CSS grids based on whatever madness you want.
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 = '%'
@krusynth
krusynth / .inputrc
Created November 20, 2012 14:08
Readline hacks
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