Skip to content

Instantly share code, notes, and snippets.

View wilkerlucio's full-sized avatar

Wilker Lúcio wilkerlucio

View GitHub Profile
@wilkerlucio
wilkerlucio / id3_renamer.rb
Created January 23, 2009 14:41
Batch rename mp3 files
#!/usr/bin/env ruby
require "rubygems"
require "id3lib"
File.instance_eval do
def mp3?(path)
File.extname(path).downcase == '.mp3'
end
end
@wilkerlucio
wilkerlucio / gist:58830
Created February 5, 2009 17:01 — forked from rails/gist:58761
Javascript Date Helper for distance in time
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
@wilkerlucio
wilkerlucio / guesser.rb
Created February 26, 2009 18:35
Binary Search theory proved
#!ruby
#--
# Copyright 2009 Wilker Lucio <wilkerlucio@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@wilkerlucio
wilkerlucio / jquery.watermark.js
Created March 3, 2009 13:36
Watermark for jQuery
(function($) {
$.fn.watermark = function() {
return this.each(function() {
this._watermark_base = this.value;
$(this).focus(function() {
if (this._watermark_base == this.value) {
this.value = '';
}
});
@wilkerlucio
wilkerlucio / core_extensions.js
Created June 10, 2009 17:23
Javascript Core Utils
/*
* Copyright 2009 Wilker Lucio <wilkerlucio@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@wilkerlucio
wilkerlucio / load_trigger.js
Created August 25, 2009 17:15
JS Page Load Trigger
/*
* Simple Page Load Trigger
*
* Copyright 2009 Wilker Lucio <wilkerlucio@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@wilkerlucio
wilkerlucio / rails_template.rb
Created November 6, 2009 02:44
Rails Template
# ignoring files
file ".gitignore", <<-TXT
log/*.log
tmp/**/*
db/*.sqlite3
.DS_Store
Thumbs.db
TXT
# download pt-br i18n and configure environment
@wilkerlucio
wilkerlucio / reset_windows
Created December 16, 2009 19:26
Reset Mac OS windows positions
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
set screen_height to item 4 of _b
end tell
@wilkerlucio
wilkerlucio / webrat_steps_br.rb
Created January 18, 2010 05:19
cucumber pt-br websteps
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
# Commonly used webrat steps
#!/usr/bin/env ruby
#
# Put this script in your PATH and download from onemanga.com like this:
# onemanga_downloader.rb Bleach [chapter number]
#
# You will find the downloaded chapters under $HOME/Documents/OneManga/Bleach
#
# If you run this script without arguments, it will check your local manga downloads
# and check if there are any new chapters
require 'rubygems'