This file contains hidden or 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 cache | |
Output => -3400421267002374593 :: -1797544009241115821 :: 4 | |
0.000000 0.000000 0.000000 ( 4.000965) | |
Output => -3400421267002374593 :: -1797544009241115821 :: 4 | |
0.000000 0.000000 0.000000 ( 0.000068) | |
Output => -3400421267002374593 :: -1797544009241115821 :: 4 | |
0.000000 0.000000 0.000000 ( 0.000069) | |
Output => -3400421267002374593 :: -2043295954666096465 :: 6 | |
0.000000 0.000000 0.000000 ( 6.001122) | |
Output => -3400421267002374593 :: -2043295954666096465 :: 6 |
This file contains hidden or 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
# copied from the texticle gem documentation: | |
# link: http://tenderlove.github.com/texticle/ | |
class CreateFeeds < ActiveRecord::Migration | |
def self.up | |
sql = <<-SQL | |
CREATE VIEW feeds AS | |
SELECT articles.id AS feedable_id, articles.title AS title, | |
CAST ('Article' AS varchar) AS feedable_type | |
FROM articles |
This file contains hidden or 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
# encoding: utf-8 | |
# Small module to add the ability to register callbacks at class level to use it at instace level. | |
# With this module you can create small DSLs on your classes. | |
# | |
# Example usage: | |
# | |
# class Person | |
# include ::Callbacks | |
# |
This file contains hidden or 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
# -*- encoding: utf-8 -*- | |
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
# code... | |
def present(object, klass = nil) | |
presenter = ::BasePresenter.build(object, self, klass) |
This file contains hidden or 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
# -*- encoding: utf-8 -*- | |
module ApplicationHelper | |
def title(txt, show = true) | |
content_for(:title) { h(txt.to_s) } | |
@show_title = show | |
show_title | |
end |
This file contains hidden or 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 the gcc in the environment | |
env CC=/usr/bin/gcc rbenv install ruby-interpreter-here |
This file contains hidden or 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
#!/bin/sh | |
# passman - GPL3 - nibble <develsec.org> 2009 | |
# Minimal password manager | |
# link: http://nibble.develsec.org/hg/toys/file/ddaf55c59fc7/passman | |
PASSFILE=~/.passmandb | |
TMPFILE=~/.passmandb.$$ | |
trap "shred -fuz ${TMPFILE}" 0 2 15 && | |
umask 177 && |
This file contains hidden or 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
#!/bin/sh | |
# | |
# Do not commit files with the flag: NOCOMMIT | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 |
This file contains hidden or 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
# borrowed from: http://log.iany.me/post/16812080563/git-rm-deleted-files | |
git ls-files -d | xargs git rm |
This file contains hidden or 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
perl -e "s/old_pattern/new_pattern/g;" -pi.save $(ack -f path/to/files) | |
# NOTE: this will create *.save files. Remove them with: rm -f **/*.save |