Skip to content

Instantly share code, notes, and snippets.

View wbotelhos's full-sized avatar
💭
I'm not my code.

Washington Botelho wbotelhos

💭
I'm not my code.
View GitHub Profile
@henrik
henrik / hash_deep_diff.rb
Created July 14, 2009 08:38
Recursively diff two Ruby hashes.
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')
@olleolleolle
olleolleolle / raty.diff
Created October 15, 2010 11:07
Makes the onclick handler have a "this" that is the useful star element.
diff --git a/js/jquery.raty.js b/js/jquery.raty.js
index cefc128..7b09b81 100755
--- a/js/jquery.raty.js
+++ b/js/jquery.raty.js
@@ -140,7 +140,7 @@
.live('click', function() {
$('input#' + containerId + '-score').val(0);
if (onClick) {
- onClick(0);
+ onClick.apply($this, [0]);
class HelloWorldController < AbstractController::Base
include AbstractController::Rendering
include AbstractController::Layouts
include AbstractController::Helpers
include AbstractController::Translation
include AbstractController::AssetPaths
include ActionController::UrlWriter
# Uncomment if you want to use helpers defined in ApplicationHelper in your views
# helper ApplicationHelper
<target name="minify">
<property name="static.library.dir" value="${build.dir}/${project.web}/static/library" />
<property name="yuicompressor.jar" value="/opt/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar" />
<fileset dir="${project.web}/web/static/library" includes="*.js" excludes="*.min.js" id="alljs" />
<fileset dir="${project.web}/web/static/library" includes="*.css" excludes="*.min.css" id="allcss" />
<delete file="${build.dir}/${project.web}/static/library/all.css" />
<concat destfile="${build.dir}/${project.web}/static/library/all.css" fixlastline="true">
<fileset refid="allcss" />
@JoseRibeiro
JoseRibeiro / Kill mvn jetty:run
Created January 13, 2011 12:57
Kill mvn jetty:run
ps ax | grep jetty | grep -v grep | awk '{system("kill -9 "$1)}'
class Message < ActiveRecord::Base
validate :image_size_validation, :if => Proc.new { |m| m.image.present? }
mount_uploader :image, MessageImageUploader
private
def image_size_validation
errors[:image] << "should be less than 2MB" if image.size > 2.megabytes
end
@leohackin
leohackin / rastrear_encomenda_correios_for_mac
Last active September 24, 2015 21:27
Script para rastreamento contínuo de encomenda nos Correios via linha de comando for Mac.
#!/bin/bash
# Created by Léo Hackin (leohackin at gmail.com), Jan 2011
# This file is free software. You are free to use this file in any way you like
# However, if you change it you should note in this file that you did and who
# you are, you also need to change the version string if you do. That way
# I will not get support questions for software that is not entirely mine.
# rastreia_encomenda_correios v.0.1a for mac
@unixmonkey
unixmonkey / Cucumber Plain Text Feature.tmLanguage
Created March 10, 2011 20:15
Cucumber Language definition file for TextMate; modified to work with Sublime Text 2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>feature</string>
</array>
<key>firstLineMatch</key>
<string>기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Особина|Могућност|Özellik|Właściwość|Tính năng|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd(.*)</string>