Rails Style Params in Python and Flask
Ruby on Rails does a great job of parsing arrays in form data and populating a params hash, for quick and easy access in your controllers. For instance Gives you params[:item] # => ["item 1", "item 2"] Flask doesn't do this work f...
Written by Sean Behan on 11/04/2018
How to Merge a YAML File Into a Single Hash in Ruby
require 'yaml' # Nested YAML structure from something-nested.yml # # nested: # key: value # key_two: value_two # Procedural Approach to building a single Hash from nested YAML data structure. @yaml = YAML.load_file("something-nested...
Written by Sean Behan on 06/17/2012
My First Ruby Gem: Hashed_Attributes
I just wrote and released my first Ruby Gem, Hashed Attributes https://rubygems.org/gems/hashed_attributes. It is a very simple ActiveRecord extension for saving variables through a serialized hash. The Gem will let you declare getter and setter methods t...
Written by Sean Behan on 06/17/2012
SHA1 or MD5 Hashing in Python
import hashlib print hashlib.sha1("My wonderful string").hexdigest() print hashlib.md5("My other wonderful string").hexdigest()
Written by Sean Behan on 06/17/2012