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
# This is an internal_redirect_to function by Sandro Paganotti | |
# http://www.railsonwave.com/2008/10/25/how-to-call-a-controller-s-action-from-a-different-controller | |
# By using this internal_redirect_to function you will be able to | |
# get the same results as a normal redirect_to without send anything | |
# to the user, only keep in mind to explicit invoke the return after | |
# this function. | |
class ApplicationController | |
def internal_redirect_to (options={}) |
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
#!/usr/bin/env ruby | |
if ARGV.size == 0 | |
lines = `ls -1 *.tmproj 2>/dev/null`.split("\n") | |
if lines.size == 1 | |
`open #{lines[0]}` | |
else | |
`mate .` | |
end | |
else |
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
# MIGRATION | |
class CreateBasicTables < ActiveRecord::Migration | |
def self.up | |
create_table :books, :force => true do |t| | |
t.string :title | |
t.timestamps | |
end | |
create_table :authors, :force => true do |t| | |
t.string :name |
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
#!/usr/bin/env ruby -w | |
require 'rubygems' | |
require 'Text' | |
results = {} | |
Dir.glob("top100_*.txt") do |filename| | |
File.read(filename).split("\n").each do |song| | |
stripped = song.gsub(/[^a-z0-9]/, '').downcase |
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
<!-- | |
Replace the sections with {} with their real values | |
Add the content | |
Convert it with: | |
html2mobi --author "{AUTHOR GOES HERE}" this.html | |
--> | |
<html> | |
<head> | |
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" /> | |
<title>{TITLE GOES HERE}</title> |
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
FDJ = {} | |
FDJ.EventScroller = { | |
init: function() { | |
setTimeout(function() { | |
FDJ.EventScroller.start_all(); | |
}, 3000); | |
console.log("Setting timeout - done"); | |
}, | |
start_all: function() { | |
$(".wrapper").each(function() { |
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
fdjstage: | |
rails_env: fdjstage_public | |
rails_root: /home/fdjstage-public/fortaleza/current | |
cap_binary: /home/agp/local/ruby-ee/bin/cap | |
ruby_binary: /home/agp/local/ruby-ee/bin/ruby | |
rubyrep_binary: /home/agp/local/ruby-ee/bin/rubyrep | |
ssh_key: /home/agp/.ssh/id_rsa | |
user: agp | |
database: | |
adapter: mysql |
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
$ gem list --local|grep 'LVS-JSONService' | |
LVS-JSONService (0.2.5, 0.2.4, 0.2.3, 0.2.2, 0.2.1) | |
$ irb | |
>> require 'rubygems' | |
=> false | |
>> require 'nokogiri' | |
=> true | |
# Just checking gems load OK | |
>> require 'jsonservice' |
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 'rubygems' | |
require 'builder' | |
favorites = { | |
'candy' => 'Neccos', 'novel' => 'Empire of the Sun', 'holiday' => 'Easter' | |
} | |
xml = Builder::XmlMarkup.new(:indent => 2 ) do |b| | |
b.instruct! :xml, :version => "1.1", :encoding => "UTF-8" |