Skip to content

Instantly share code, notes, and snippets.

View pushcx's full-sized avatar

Peter Bhat Harkins pushcx

View GitHub Profile
@pushcx
pushcx / Gemfile
Last active August 29, 2015 14:25 — forked from solnic/anima_vs_virtus.rb
source 'https://rubygems.org'
gem 'activerecord'
gem 'anima'
gem 'sqlite3'
gem 'transproc'
gem 'virtus'
gem 'benchmark-ips'
entity = Node.new(id: id)
case
when not enity.exists? then fail("Entity doesn't exist")
when not entity.file? then fail("Entity wasn't a file")
when not entity.writable? then fail("Entity wasn't writable")
else entity.write(data)
end
location ~ ^/(wp-admin|wp-login\.php|priv\.dog|companies\/sidekick) {
deny all;
break;
}
# file extensions that should never be served, this prevents
# potential malicious downloads in case someone manages to manipulate
# a Rails URL or write a file that can be served
# (~* matches case-insensitive)
location ~* \.(?:git|svn|DS_Store|asp|aspx|cgi|pt|pl|idx|php|exe|scpt|AppleScript|dll|dmg|pif|msi|application|msp|com|scr|hta|cpl|gadget|msc|jar|bat|vb|vbs|vbe|ws|wsh|inf|lnk|reg|scf|wsc|wsh|ps1|ps1xml|ps2|ps2xml|psc1|psc2|msh|msh1|msh2|mshxml|msh1xml|msh2xml)$ {
deny all;

Immutable Ruby

Libraries I talked about

  • ice_nine: Deep freeze ruby objects
  • Values: Simple immutable value objects for ruby
  • immutable_attributes: specify attributes within an ActiveRecord model that can be set but not modified
  • hamster: Efficient, Immutable, Thread-Safe Collection classes for Ruby

Next Steps