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
# 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 |
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 | |
// Ugly | |
function compare($a, $b) { | |
if ($a == $b) { | |
return TRUE; | |
} else { | |
return FALSE; | |
} |
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
hi |
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 | |
// 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"); |
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
" 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> |
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
~ > 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! |
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
var sys = require('sys'); | |
var providers = ['Google', 'Youtube']; | |
var search = { | |
Google: 'its google!', | |
Youtube: 'its youtube!' | |
} | |
for (var p in providers) { | |
if (providers[p]) { |
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
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 |
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
[web] | |
browser = open | |
[help] | |
format = web | |
[alias] | |
man = help --man | |
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
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: | |