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
#!/usr/bin/env ruby | |
# jazzfonica.rb for Mac OS X | |
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password | |
# Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt | |
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal | |
require 'digest/md5' | |
messages = [] | |
unless !File.exists?('/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport') |
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
namespace :assets do | |
desc "Normalize all Candidate attachments names" | |
task :normalize => :environment do | |
Candidate.find(:all, :conditions => ['candidates.id >= ? AND candidates.avatar_file_name IS NOT ?', ENV['RESUME'] || 1, nil]).each do |candidate| | |
@old_paths = {} | |
@bucket = ENV['BUCKET'] || 'jobandtalent_staging' | |
begin | |
%w{original identity contact profile}.each do |style| | |
@old_paths.merge!({style => candidate.avatar.path(style)}) | |
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
# Slightly improved version of http://github.com/qoobaa/s3/blob/master/extra/s3_paperclip.rb, with support | |
# for buckets in locations other than standard US. | |
# S3 backend for paperclip plugin. Copy the file to: | |
# +config/initializers/+ directory | |
# | |
# Example configuration for CNAME bucket: | |
# | |
# has_attached_file :image, |
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
# In your .bash_profile or .bashrc | |
# show active git branch in prompt | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
} | |
# customize the prompt variable | |
export PS1="\u@\h:\w \$(git_branch)$ " |
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
require 'rubygems' | |
require 'benchmark' | |
require 'almodovar' # http://github.com/bebanjo/almodovar | |
auth = Almodovar::DigestAuth.new("Sequence", "api_user", "secret") | |
sequence = Almodovar::Resource("http://sequence.local/api", auth) | |
sequence.work_areas.first.name | |
# "Bebanjo TV" |
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
Project Planning | |
= | |
***SW Due date:** Feb 28, 2010* | |
***Memo Due date:** March 8, 2010* | |
* * * | |
Iteration 1: Feb 1-4 | |
- |
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
products = Product.where("price = 100").limit(5) # No query executed yet | |
products = products.order("created_at DESC") # Adding to the query, still no execution | |
products.each { |product| puts product.price } # That's when the SQL query is actually fired | |
class Product < ActiveRecord::Base | |
named_scope :pricey, where("price > 100") | |
named_scope :latest, order("created_at DESC").limit(10) | |
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
Hash.class_eval do | |
def deep_search(key) | |
res=[] | |
res << self[key] | |
values.select{|v| v.is_a?(Hash) || v.is_a?(Array)}.each do |ha| | |
children=ha.deep_search(key) | |
res+= children if children | |
end | |
res.compact! | |
res.empty? ? [] : res |
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
GeoArch - Required Features 9-8-09 | |
---------------------------------- | |
* Multiple images creation and edition for an ipoint. | |
* Simple search for ipoints by name? | |
* Users can create a route with several points. | |
* Users can edit the routes they create. | |
* Logged users can save the routes they create too. |
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 AddPhotoColumnsToIpoints < ActiveRecord::Migration | |
def self.up | |
add_column :ipoints, :photo_file_name, :string | |
add_column :ipoints, :photo_content_type, :string | |
add_column :ipoints, :photo_file_size, :integer | |
add_column :ipoints, :photo_updated_at, :datetime | |
end |