This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Para salvar a altura e largura das imagens enviadas pelo plugin paperclip, utilize o callback abaixo | |
# | |
# class Document < ActiveRecord::Base | |
# | |
# has_attached_file :document, :styles => { :medium => "300x300>" } | |
# | |
# before_save :save_dimensions | |
# | |
# def save_dimensions | |
# if document.image? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Interval = function( fn, delay ) { | |
this.id = null; | |
this.fn = fn; | |
this.delay = delay; | |
}; | |
Interval.prototype = { | |
start: function() { | |
if (this.id === null) this.id = setInterval(this.fn, this.delay); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["WATCHR"] = "1" | |
system 'clear' | |
def growl(message) | |
growlnotify = `which growlnotify`.chomp | |
title = "Watchr Test Results" | |
message.gsub! /\[[0-9]+?m/, '' | |
image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/pass.png" : "~/.watchr_images/fail.png" | |
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" | |
system %(#{growlnotify} #{options} &) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.extend({ | |
replaceClass: function(original, replace) { | |
return this.each(function() { | |
jQuery(this).removeClass(original); | |
jQuery(this).addClass(replace); | |
}); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1..100).each{|n|f=n%3==0?"Fizz":nil;b=n%5==0?"Buzz":nil;p f||b ?"#{f}#{b}":n} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This file is part of the Spludo Framework. | |
* Copyright (c) 2009-2010 DracoBlue, http://dracoblue.net/ | |
* | |
* Licensed under the terms of MIT License. For the full copyright and license | |
* information, please see the LICENSE file in the root folder. | |
*/ | |
var child_process = require('child_process'); | |
var fs = require("fs"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rspec' | |
class TestBug | |
attr_reader :array | |
def initialize | |
@array = [] | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1..10).each do |i| | |
print "\r" | |
print "#{i}" | |
sleep 0.1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'highline' | |
prompt = HighLine.new | |
prompt.say("Hello!") | |
username = prompt.ask("Tell me your username: ") | |
password = prompt.ask("And now your password: ") { |options| options.echo = false } | |
prompt.say("Thanks #{username}! bye") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AuthenticationMatcher | |
class RequireAuthentication | |
def initialize(method, action, params, context) | |
@method = method | |
@action = action | |
@params = params | |
@context = context | |
end | |
def matches?(controller) |
OlderNewer