Skip to content

Instantly share code, notes, and snippets.

@BlueVajra
BlueVajra / html_response.rb
Last active August 29, 2015 14:01
HTML response warmup
require 'json'
require 'launchy'
class HttpResponse
attr_reader :headers, :body, :status_code
def initialize(response)
parse_response(response)
end
@BlueVajra
BlueVajra / model_validation.rb
Created April 30, 2014 23:09
Rails Examples
class Url < ActiveRecord::Base
validates :url, presence: {message: "URL can not be blank"}
validates :url, format: {
with: /(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?/ix,
message: "The text you entered is not a valid URL"
}
end
@BlueVajra
BlueVajra / gist:8796206
Last active August 29, 2015 13:56
Add spaces to the mac toolbar
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'