Skip to content

Instantly share code, notes, and snippets.

View rujmah's full-sized avatar
👨‍🚀
Looking to the future

Robin Mayfield rujmah

👨‍🚀
Looking to the future
View GitHub Profile
# rubygems DNS is temporarily down, put this into your /etc/hosts to install gems,
# but don't forget to remove the entries once their DNS is back up again
72.4.120.124 rubygems.org
207.171.181.231 production.s3.rubygems.org
216.137.45.24 production.cf.rubygems.org
@rujmah
rujmah / Rails MongoMapper Template.rb
Created May 21, 2012 09:56 — forked from banker/Rails MongoMapper Template.rb
A Rails Template for using MongoMapper
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/gists/219223.txt
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
@rujmah
rujmah / gist:2761591
Created May 21, 2012 09:57 — forked from jasonmccay/gist:1145512
mongoid config
defaults: &defaults
autocreate_indexes: true
max_retries_on_connection_failure: 3
allow_dynamic_fields: false
development:
host: localhost
database: taq_development
@rujmah
rujmah / mongoid_tags.rb
Created May 21, 2012 09:58
Mongoid_tags
class Tag
include Mongoid::Document
field :name
embedded_in :taggable, polymorphic: true
end
class Category
include Mongoid::Document
embeds_many :tags, class_name: "Tag", as: :taggable
def tag_list
@rujmah
rujmah / insertyoutubefeed
Created July 5, 2012 16:42 — forked from planetoftheweb/insertyoutubefeed
Insert YouTube Channel Feed & Player into any site using JSON
<style>
#videogroup {
width: 100%;
}
iframe {
width: 90%;
padding: 5%;
}

A Backbone.js demo app (Sinatra Backend)

Oct 16 2010

Updates

  • 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments

In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].

@rujmah
rujmah / _gradients.css.scss
Created November 5, 2012 16:36 — forked from thbar/_gradients.css.scss
SCSS mixing for CSS3 gradients
@mixin gradient($from, $to) {
/* fallback/image non-cover color */
background-color: $from;
/* Firefox 3.6+ */
background-image: -moz-linear-gradient($from, $to);
/* Safari 4+, Chrome 1+ */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to));
@rujmah
rujmah / rename.rake
Created December 13, 2012 14:40 — forked from ebot/rename.rake
namespace 'rails' do
desc 'Renames the current app'
task 'rename' do
# Get the new name
new_name = ENV["NEW_NAME"].capitalize || nil
if new_name.nil?
puts "\nYou must pass in a new name"
exit
end
#!/usr/bin/env ruby
require "redis"
redis = Redis.new
redis.keys("*").each do |key|
val = case redis.type(key)
when "string"
redis.get key
when "list"
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)