Skip to content

Instantly share code, notes, and snippets.

Avatar
🍊
workin' goodly

Gianni Chiappetta gf3

🍊
workin' goodly
View GitHub Profile
@gf3
gf3 / shotweb.rb
Created Dec 11, 2008 — forked from anonymous/shotweb.rb
Downloads all releases from Luna-C's website.
View shotweb.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
BASE_URL = "http://www.kniteforcerevolution.com"
PAGE_URL = "#{BASE_URL}/music/"
FILE_URL = "#{BASE_URL}/file_download/"
View shotweb.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
BASE_URL = "http://www.kniteforcerevolution.com"
PAGE_URL = "#{BASE_URL}/music/"
FILE_URL = "#{BASE_URL}/file_download/"
View casechecker.rb
#!/usr/bin/env ruby -w
def find_caseinsensitive_duplicates(dir)
# INIT
conflicts = {}
# Load file list
files = Dir.entries(dir).collect{|f| f.downcase }
# Do yo thang!
View git-select-add.rb
#!/usr/bin/env ruby
# Git - Select Add
# Written by: Gianni Chiappetta <gianni[at]runlevel6[dot]org>
require 'rubygems'
require 'git' # http://github.com/schacon/ruby-git
MODES = {
"M" => "Modified"
@gf3
gf3 / hoverer.js
Created Apr 9, 2009 — forked from fermion/hoverer.js
Hover class for Prototype
View hoverer.js
var Hoverer = {
current: null,
delay: 0.5,
timer: null,
handler: function(event) {
var element = event.findElement('div.nav_menu');
if (!element)
return Hoverer.leave();
if (element == Hoverer.current)
@gf3
gf3 / getScrollbarWidth.js
Created Apr 15, 2009
Get the width of the scrollbars on a page.
View getScrollbarWidth.js
function getScrollbarWidth() {
if (this.scrollbarWidth) {
return this.scrollbarWidth;
}
var inner = document.createElement('p');
inner.style.width = '100%';
inner.style.height = '200px';
var outer = document.createElement('div');
outer.style.position = 'absolute';
@gf3
gf3 / gist:101164
Created Apr 24, 2009 — forked from fermion/gist:101162
Rake task to pack JS files.
View gist:101164
require 'packr'
namespace :js do
desc "Pack javascript src for production environment"
task :pack => :environment do
# Files to pack
Dir.glob(File.join("public", "javascripts", "**", "*.js")).each do |filename|
puts "packing #{filename}..."
FileUtils.cp(filename, "#{filename}.orig")
js = ""
@gf3
gf3 / abs_phone.rb
Created May 21, 2009
Get the absolute value of a phone number.
View abs_phone.rb
# Get the absolute value of a phone number
def abs_phone(phone)
abs = []
phone = phone.gsub(/[^a-zA-Z0-9]/, '').downcase
phone.each_byte do |b|
case b
when 0..96
abs << (b - 48)
when 122
abs << ((((b-97).to_f/3.0)+1.0).round)
@gf3
gf3 / viewable.js
Created May 21, 2009
Amount of element viewable.
View viewable.js
Element.addMethods({
viewable: function(el) {
// INIT
el = $(el);
var scroll = document.viewport.getScrollOffsets();
var viewport = document.viewport.getDimensions();
var offsets = el.cumulativeOffset();
var dimensions = el.getDimensions();
// Sanity check
@gf3
gf3 / gist:119382
Created May 28, 2009
iTerm Automation - Apple Script
View gist:119382
tell application "iTerm"
activate
-- Close the first session
terminate the first session of the first terminal
-- New Terminal
set myterm to (make new terminal)
tell myterm
-- Tab 1 (Server)
launch session "Default"