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
# los requires no son necesarios dentro de rails, obviamente :p | |
require 'rubygems' | |
require 'active_support' | |
# format_event retorna un hash formateado a como querés, por lo cual al resultado le podés hacer .to_json | |
def format_event(event_hash) | |
# Si no hay imagenes retorna un hash con info "vacía" | |
return {:totalImages => '0', :images => {}} if (event_hash['images'].nil? || event_hash['images']['image'].nil?) | |
# por legibilidad está en varias líneas :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
# frnz's Ruby on Rails template | |
############## plugin commands ################# | |
# RSpec is the original Behaviour Driven Development framework for Ruby. | |
plugin 'rspec', | |
:git => "git://github.com/dchelimsky/rspec.git" | |
# The world's greatest templating system | |
plugin 'haml', |
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
# Guide | |
# Configure the essential configurations below and do the following: | |
# | |
# Repository Creation: | |
# cap deploy:repository:create | |
# git add . | |
# git commit -am "initial commit" | |
# git push origin master | |
# | |
# Initial Deployment: |
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
#!/bin/bash | |
# | |
# Install rmagick without fink or macports | |
# Shameless copy from: http://www.agileanimal.com/2009/08/11/imagemagick-and-rmagick-on-leopard-and-other-large-white-cats | |
# | |
# Requirements: Mac OS X >= 10.5.4, XCode 3.1, X11 | |
#Install freetype | |
curl -O http://mirror.csclub.uwaterloo.ca/nongnu/freetype/freetype-2.3.9.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
#!/bin/bash | |
scp ~/.ssh/id_rsa.pub $1:~ | |
ssh $1 "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod -R 600 ~/.ssh/* && cat ~/id_rsa.pub >> ~/.ssh/authorized_keys && rm ~/id_rsa.pub" |
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
# I get the images from the autotest-growl gem, so I put this on my gemfile: | |
# (If you want to use another images you can find an example here: http://szeryf.wordpress.com/2007/07/30/way-beyond-cool-autotest-growl-doomguy/) | |
gem "rspec" | |
gem "rspec-rails", "~> 2.0.1" | |
gem "ZenTest" | |
gem "autotest" | |
gem "autotest-rails" | |
gem "autotest-growl" # <= here it is | |
gem "ruby-debug" |
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
" Save as conceal.vim at ~/.vim/bundle/ruby-conceal/after/syntax/ruby if you | |
" use Pathogen or at ~/.vim/after/syntax/ruby otherwise | |
if !has('conceal') | |
finish | |
endif | |
syntax keyword rubyControl not conceal cchar=¬ | |
syntax keyword rubyKeyword lambda conceal cchar=λ | |
set conceallevel=2 |
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 User | |
include DataMapper::Resource | |
has n, :projects | |
end | |
class Project | |
include DataMapper::Resource | |
belongs_to :user, :key => true | |
has n, :steps |
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
# Primero te recomiendo hacer un método 'encript' así: | |
def encript(hash) | |
# Devuelve el mismo hash, pero haciéndole digest al password | |
hash[:password] = Digest::MD5.hexdigest(hash[:password]) | |
return hash | |
end | |
# De esa manera podés hacer esto: | |
post '/signup' do |
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
{:password=>"39c8e9953fe8ea40ff1c59876e0e2f28", "username"=>"mitasdf", "password"=>"sdfsdfsdfsdf", "email"=>"[email protected]"} | |
Es que pensé que se usaba [:password] en params (como rails). Nada más usá "password" en lugar de :password: | |
def encript(hash) | |
# Devuelve el mismo hash, pero haciéndole digest al password | |
hash["password"] = Digest::MD5.hexdigest(hash["password"]) | |
return hash | |
end |
OlderNewer