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
# set the gcc in the environment | |
env CC=/usr/bin/gcc rbenv install ruby-interpreter-here |
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
# -*- 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 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 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 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 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 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
# link: http://linssen.me/entry/archive-your-git-repo-easily/ | |
git archive HEAD | gzip > $PWD\.tar\.gz |
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
require 'thor' | |
class VimInstaller < Thor::Group | |
include Thor::Actions | |
def self.source_root | |
'/tmp' | |
end | |
def clean_up |
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
-# Code... | |
%body{ :"data-controller" => controller_name, :"data-action" => action_name } | |
-# Code... |
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
# encoding: utf-8 | |
# | |
# Extract from: | |
# @link: http://www.mattsears.com/articles/2011/11/27/ruby-blocks-as-dynamic-callbacks | |
# @link: http://techscursion.com/2011/11/turning-callbacks-inside-out | |
class ProcCallback | |
def initialize(callable, *args) | |
@callable = callable.to_s | |
@arguments = args.dup |