user = User.new
user.first_name = "Ben"
user[:first_name] = "Ben"
user.read_attribute(:first_name)
# => "Ben"
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
# in config/initializers/navigatrix.rb | |
Navigatrix.register_item_renderer(:my_item) do | |
def link | |
link_to(name, path, class: "my-class") | |
end | |
def unlinked_content | |
content_tag(:span, name) | |
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
class ContextMatters.CompositeRouter extends Backbone.Router | |
constructor: -> | |
@route("*path", "extractComponents") | |
super | |
extractComponents: (path) -> | |
@changes ||= {} | |
for namespace, payload of @_decode(path) | |
unless _.isEqual(@changes[namespace], payload) |
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
grep '50.31.164.139\|50.112.95.211\|54.247.188.179\|54.248.250.232\|54.251.34.67\|184.73.237.85\|50.18.57.7\|54.214.255.205\|54.228.244.177\|54.232.123.139\|54.241.22.142\|54.248.225.67\|54.251.109.246\|54.252.114.169\|54.252.114.170\|177.71.245.207\|200' log/production.log |
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 < ActiveRecord::Base | |
has_many :comments | |
accepts_nested_attributes_for :comments | |
end | |
class Comment < ActiveRecord::Base | |
belongs_to :user | |
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
More Codez |
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
activty stream |
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 | |
# Usage: ./encode-test /path/to/encode.c | |
require 'fileutils' | |
def directory(path) | |
path = File.expand_path(path) | |
if File.directory?(path) | |
path |
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 < ActiveRecord::Base | |
has_many :tasks | |
def self.with_flagged_comments | |
includes(:task).merge(Task.with_flagged_comments) | |
end | |
end | |
class Task < ActiveRecord::Base | |
belongs_to :user |
OlderNewer