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
@rujmah
rujmah / s3_bucket_contents_remove.rb
Created July 3, 2012 08:30
AWS S3 Delete Bucket Contents with Ruby
require 'aws/s3'
s3 = AWS::S3.new(
:access_key_id => 'ACCESS_KEY',
:secret_access_key => 'SECRET_KEY'
)
bucket = s3.buckets['BUCKET_NAME']
c = bucket.objects.count
puts "size #{c}"
@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 / redcarpet_example.md
Created December 7, 2012 11:07
Sample Redcarpet Rendering for markdown

Frustrating couple of hours banging my head against the GFM and Redcarpet pages before I saw Ryan's example:

    renderer = Redcarpet::Render::HTML.new(hard_wrap: false, filter_html: true)
    options = {
      autolink: true,
      no_intra_emphasis: true,
      fenced_code_blocks: true,
      lax_html_blocks: true,
 strikethrough: true,
@rujmah
rujmah / gist:4234589
Created December 7, 2012 16:51
Redcarpet renders markdown
renderer = Redcarpet::Render::HTML.new(hard_wrap: false, filter_html: true)
options = {
autolink: true,
no_intra_emphasis: true,
fenced_code_blocks: true,
lax_html_blocks: true,
strikethrough: true,
superscript: true
}
Redcarpet::Markdown.new(renderer, options).render(text).html_safe
@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)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')