Skip to content

Instantly share code, notes, and snippets.

View itspriddle's full-sized avatar
🤘
clickity clack

Joshua Priddle itspriddle

🤘
clickity clack
View GitHub Profile
@itspriddle
itspriddle / will_paginate.rb
Created October 6, 2011 19:04
extends will_paginate to play well with Twitter's Bootstrap
# config/initializers/will_paginate.rb
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
<?php
// Ugly
function compare($a, $b) {
if ($a == $b) {
return TRUE;
} else {
return FALSE;
}
<?php
// Usage: Drop this script in _import and then run `php import.php`
// It will import posts from WordPress as markdown
// EDIT THESE
ini_set('date.timezone', 'America/New_York');
$con = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('blog_test');
$q = mysql_query("SELECT * FROM blog_posts");
" Tabular.vim
nmap <Leader>a= :Tabularize /^[^=]*\zs=>\?<CR>
vmap <Leader>a= :Tabularize /^[^=]*\zs=>\?<CR>
nmap <Leader>a: :Tabularize /:\zs/l0r1<CR>
vmap <Leader>a: :Tabularize /:\zs/l0r1<CR>
nmap <Leader>a, :Tabularize /,\zs/l1r0<CR>
vmap <Leader>a, :Tabularize /,\zs/l1r0<CR>
~ > brew install https://raw.github.com/gist/1187345/3daa0f4d9602dd20c07ea5c4be763d3dcceb0ab6/percona-server.rb
######################################################################## 100.0%
Warning: Building with LLVM, but this formula is reported to not work with LLVM:
https://github.com/mxcl/homebrew/issues/issue/144
We are continuing anyway so if the build succeeds, please open a ticket with
the following information: 2335-10.7. So
that we can update the formula accordingly. Thanks!
var sys = require('sys');
var providers = ['Google', 'Youtube'];
var search = {
Google: 'its google!',
Youtube: 'its youtube!'
}
for (var p in providers) {
if (providers[p]) {
class OnePassword
DATA = File.read("#{ENV['HOME']}/Desktop/1Password.txt")
def self.passwords
return @passwords if @passwords
data = DATA.dup.lines.to_a.map { |line| line.strip.split("\t") }
header = data.shift
@passwords = data.map {|line| Hash[header.zip(line)]}
end
[web]
browser = open
[help]
format = web
[alias]
man = help --man
@itspriddle
itspriddle / gist:1106724
Created July 26, 2011 13:13
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules: