Skip to content

Instantly share code, notes, and snippets.

View bradylove's full-sized avatar

Brady Love bradylove

  • Pivotal
  • Highlands Ranch, CO
View GitHub Profile
Open-Mastery Todo List:
- Update to rails 3.2.1
- Make it searchable. @priority(1)
this ones going to take some research
- Give it a sitemap @priority(3)
- Write some how-to's @priority(1)
- Make the system smarter to support sub-folders/groups @priority(4)
- Make it super pretty @priority(5)
- Add Comments via Disqus @priority(3)
def super_random
rand(1..1000000)
rand(1..1000000)
rand(1..5)
end
case super_random
when 1
puts "You are staying in construction"
when 2
@bradylove
bradylove / gist:1898218
Created February 24, 2012 06:02
bootstrap flash notices
- flash.each do |name, msg|
.alert-message{:class => "#{name.to_s} fade in", "data-alert" => "alert"}
%a.close{:href => "#"} ×
%p
= msg
@bradylove
bradylove / gist:1898220
Created February 24, 2012 06:02
bootstrap flash notices
- flash.each do |name, msg|
.alert{:class => "alert-#{name.to_s} fade in", "data-alert" => "alert"}
%a.close{:href => "#"} ×
%p
= msg
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :start_logging
after_filter :complete_logging
def after_sign_in_path_for(resource)
root_url(:subdomain => resource.slug)
end
rescue_from CanCan::AccessDenied do |exception|
AquaLogger:
- Splash page with sign-up @priority(1)
- Beta invite system @priority(1)
- Add Tanks @priority(2)
- Add Parameters (Belongs to tanks) @priority(2)
class Feed < ActiveRecord::Base
validates :uri, presence: true,
format: { with: /(^$)|([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix }
def load_feed
@cache ||= Redis.new
if @cache.exists("Feed:#{self.uri}")
return Feedzirra::Feed.parse(@cache.get "Feed:#{self.uri}")
else
before_create :set_new_user_role
def set_new_user_role
if user is first user
then user.role = admin_role_id
user.save
else
user.role = default_role_id
user.save
end
@bradylove
bradylove / binary.rb
Created April 3, 2012 04:58
Simple Ruby app to convert text to binary
#!/usr/bin/env ruby
# Convert strings into binary!
# save as binary (without .rb)
# Usage ./binary string to be converted to binary (quotes not required)
class String
def to_binary
binary = ""
require 'typhoeus'
require 'json'
module Gitlax
class User
attr_accessor :user_login, :profile
def initialize(options = {})
@user_login = options[:login] || nil