#Mac OS X
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
#### image_map_coordinate.rb #### | |
class ImageMapCoordinate < ActiveRecord::Base | |
belongs_to :image_map | |
# FIXME: validation bug? | |
%w(w h x y).each do |v| | |
validates_numericality_of eval ":#{v}" | |
end | |
validate :href_validator |
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
# Example of how I'm using Rufus. I'm basically starting a scheduler, then | |
# using my backend to persist the job_id for the option to cancel it later. | |
# config/initializers/schedule.rb | |
SCHEDULER = Rufus::Scheduler.start_new | |
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 Organization < ActiveRecord::Base | |
attr_accessible :name, :employee_number, :country, :postal_code, :sic_code, :primary_url, :social_entities_attributes, :social_channels_attributes | |
has_one :user | |
has_one :social_score, :through => :social_entities | |
has_many :social_entities | |
has_many :social_channels, :through => :social_entities | |
accepts_nested_attributes_for :social_entities, :social_channels | |
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
# Implement status states in code using an integer column in the DB | |
# Written by Jamil Bou Kheir, 2012 | |
# | |
# Include this module at the top of your model and use the stuffed_table_columns | |
# method to assign the mappings. Requires a matching integer column present. | |
# Ex: | |
# | |
# class StirFry < ActiveRecord::Base | |
# include StuffedTableColumns | |
# stuffed_column :status, 'cold', 'hot', 'pickled', 'spicy', 'no_msg', 'noodling' |
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
# Fixes OS X clipboard under tmux | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# Allows for faster key repetition | |
set -s escape-time 0 | |
# Rather than constraining window size to the maximum size of any client | |
# connected to the *session*, constrain window size to the maximum size of any | |
# client connected to *that window*. Much more reasonable. | |
setw -g aggressive-resize on |
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
.DS_Store | |
*.tmproj | |
log/*.lck | |
log/*.log | |
public/uploads | |
*.*.sw* | |
.notes |
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
{ | |
// See http://www.jshint.com/options/ for in-depth explanations | |
// Predefined globals that JSHint ignores | |
"browser" : true, // standard globals like 'window' | |
"devel" : true, // development globals, e.g. 'console' | |
"nonstandard" : true, // widely-adopted globals, e.g. 'escape' | |
"node" : true, | |
"jquery" : true, |
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
// handle signed numbers | |
var toHex = function(decimalInt) { | |
if (decimalInt < 0) { | |
decimalInt += 0xFFFFFFFF + 1; | |
} | |
return decimalInt.toString(16).toUpperCase(); | |
}; | |
var set1, set2, set3, pair1, pair2, sym_key=''; |
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
# Represent states such as 'active', 'disabled', etc in the DB as an int | |
# | |
# Use like so: | |
# | |
# class MyModel < ActiveRecord::Base | |
# include StuffedTableColumns | |
# stuffed_column :status, *(%w(active inactive blocked disabled banned)) | |
# end | |
# TODO: use method_missing to match the column name |
OlderNewer