Skip to content

Instantly share code, notes, and snippets.

View jjt's full-sized avatar
⚔️
J̷̷͓̱͙͕̗A̖̟̰̭͎̹̱̮ͅV̷͔̩̜̭̝̫̯͝ͅA̛̘͟S̯̭̱̹͎̩̭̯C̮̪͙͈͘R̴̯̬̣̟̯̻͞I̡̖̣̬̤̰̬̦͟Ṕ̨̹̫̩̞͍Ţ̝̦

Jason Trill jjt

⚔️
J̷̷͓̱͙͕̗A̖̟̰̭͎̹̱̮ͅV̷͔̩̜̭̝̫̯͝ͅA̛̘͟S̯̭̱̹͎̩̭̯C̮̪͙͈͘R̴̯̬̣̟̯̻͞I̡̖̣̬̤̰̬̦͟Ṕ̨̹̫̩̞͍Ţ̝̦
View GitHub Profile
@jjt
jjt / common-js-extends.js
Created January 13, 2011 08:49
Various extensions to js/Mootools that I find useful here and there
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
Element.implement({
hide:function() {
this.set_disp_val();
this.setStyle('display','none');
return this;
},
@jjt
jjt / .vimrc_2011-01-19
Created January 19, 2011 22:47
.vimrc
set nocompatible
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function! MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let SessionLoad = 1
if &cp | set nocp | endif
let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
let v:this_session=expand("<sfile>:p")
silent only
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
let s:wipebuf = bufnr('%')
endif
set shortmess=aoO
badd +1 Z:\project\app\views.py
@jjt
jjt / mytmux.sh
Created January 25, 2011 10:21
My tmux.conf and a sample Django/compass/hamlpy shell script
#!/bin/bash
#
# tmux.sh - example for Django/compass/hamlpy tmux dev setup
#
mydir=/home/dev/movietempest
source $mydir/env-django-1.3.2/bin/activate
py=$mydir/env-django-1.3.2/bin/python
aliaspy=alias py="$py"
ses=mt
@jjt
jjt / hypem-controls.ahk
Created February 1, 2011 04:39
Lets you control the hype machine from other windows
#SingleInstance force
SetTitleMatchMode 2 ; Anywhere in title
SetTitleMatchMode Fast
SendMode Input
#IfWinExist Hype Machine
{
^+d::
WinActivate
return
get_kiosk_html : function(mode) {
mode = mode || 'side';
var ret_html = '',
icon_status = (this.avail == 1) ? 'on' : 'off',
class_str = this.prov + ' ' + icon_status,
el_id = this.prov + '_' + this.prov_index,
html_vals = {
id: el_id + '__' + mode,
ctrls: this.get_controls(),
cls: class_str,
// "%s is great".printf('This')
// -> This is great
//
// "{bar} or {foo}".printf({foo:'A',bar,'B'})
// -> B or A
//
// "{}, {}, {}!".printf([1,2,3])
// -> 1, 2, 3!
String.prototype.printf = function (obj) {
//gets the first matching ancestor up the tree, or returns false
//cond can be 'tag', '.classname', '#id-name', Element
Element.implement({
grabParent: function(cond,include_self) {
var parents = this.getParents(),
true_cond = '',
ret = false,
el,
i;
@jjt
jjt / redis-example.php
Created October 26, 2011 02:12
Redis example in php, with redisphp
<?php
// --------------------------------
// Plain Redis + phpredis
// --------------------------------
$redis = new Redis();
$redis->connect('127.0.0.1');
$cache = $redis->get('key');
@jjt
jjt / redis.php
Created November 25, 2011 21:45
Arbitrary redis caching of output and serializable objects
<?php
// Needs a global $redis_config
function get_redis($force=false) {
global $redis_config,$redis_instance;
if(!is_object($redis_config))
die("Couldn't find \$redis_config or it's not an object!");
// No redis? No problem!