Skip to content

Instantly share code, notes, and snippets.

def multiple number
proc {|n| (n % number) == 0 rescue nil }
end
(0..100).each do |number|
puts case number
when multiple(15) then "FizzBuzz"
when multiple(5) then "Buzz"
when multiple(3) then "Fizz"
else number
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
# encoding: utf-8
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
@ismaelga
ismaelga / zpreztorc
Created October 10, 2012 23:29
Pretzo sorin zpreztorc
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'directory' \
'spectrum' \
'gnu-utility' \
@ismaelga
ismaelga / .rspec
Created October 7, 2012 21:34
Rspec config command params
--color
--order random
--format progress
--profile
@ismaelga
ismaelga / lorens.rb
Created September 11, 2012 22:33
Lorens - Alfred extension problem
#!/usr/bin/env ruby
require "lorem"
hash = {'c' => 'chars', 'w' => 'words', 'p' => 'paragraphs'}
args = ARGV[0].split
*args = hash[args[1]], args[0].to_i
print Lorem::Base.new(*args).output
###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM
@ismaelga
ismaelga / gist:3301358
Created August 9, 2012 05:38
pt rails translation
pt-PT:
date:
abbr_day_names:
- Dom
- Seg
- Ter
- Qua
- Qui
- Sex
- Sáb
@ismaelga
ismaelga / gist:3158324
Created July 22, 2012 03:58 — forked from kevindavis/gist:1868669
Bootstrap styling for jQuery UI date picker
#ui-datepicker-div
{
.ui-datepicker-header
{
background-image: none;
background-color: #0088cc; color: #fff;
.ui-datepicker-prev span.ui-icon
{
background-image: url("/assets/glyphicons-halflings-white.png");