Skip to content

Instantly share code, notes, and snippets.

Project Planning
=
***SW Due date:** Feb 28, 2010*
***Memo Due date:** March 8, 2010*
* * *
Iteration 1: Feb 1-4
-
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"
# 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)$ "
# 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,
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
@valakirka
valakirka / jazzfonica.rb
Created June 14, 2011 13:51 — forked from christos/jazzfonica.rb
jazzfonica
#!/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')
@valakirka
valakirka / ckeditor_helper.rb
Created February 24, 2012 16:54
CKEDITOR re-configuration from view
def ckeditor_textarea(object, field, options = {})
options = options.dup.symbolize_keys
var = options.delete(:object) if options.key?(:object)
var ||= @template.instance_variable_get("@#{object}")
value = var.send(field.to_sym) if var
value ||= options.delete(:value) || ""
element_id = options.delete(:id) || ckeditor_element_id(object, field, options.delete(:index))
@valakirka
valakirka / example.rb
Created May 18, 2012 16:33
Indexes and custom sphinx_select searches
class NewsEntry < AR::Base
has_one :association
define_index do
index wadus
has association.published_at, :as => :published_at
end
end
@valakirka
valakirka / post.rb
Created August 7, 2012 16:54
Sphinx scope
class Contents::Post < Contents::Base
has_many :content_members, :as => :memberable, :dependent => :destroy
has_many :members, :through => :content_members, :class_name => "Contents::Member"
belongs_to :kt_blog, :class_name => 'Kontent::KtBlog', :touch => true
has_many :blog_categories, :through => :kt_blog, :class_name => "Kontent::KtBlogCategory"
validates_presence_of :title
validates_presence_of :summary, :unless => Proc.new {|post| post.body.present?}
validates_presence_of :kt_blog_id
Estudio 6
~~~~~~~~~
By: Leo Brouwer (1939-)
Transcribed from: "Portrait" by Kavi
Transcribed and tabbed by: John Kean
Standard tuning.
6/4 time, changing to 4/4 near the end.
Allegro (MM = 138).