Skip to content

Instantly share code, notes, and snippets.

View makevoid's full-sized avatar
:atom:
coding

Francesco 'makevoid' Canessa makevoid

:atom:
coding
View GitHub Profile
@makevoid
makevoid / object_inspection_oneliner.rb
Created April 17, 2010 08:20
Object inspection oneliner
# Hello, I made this simple ruby one liner that I found useful when inspecting ruby object I don't know much about
# It simply calls all the callable methods of the given object and presents a simple result.
# USAGE:
# replace the 'object' variable (Time.now in the example) with your favourite object
# irb version:
object = Time.new; (object.methods - Object.methods).map{ |m| meth = object.method(m.to_sym); begin; [meth.name, meth.call] if meth.arity == 0; rescue Exception; end }.compact
# readable version:
@makevoid
makevoid / gemspec generator script based on git-config info
Created May 13, 2010 22:27 — forked from defunkt/gemspec
gemspec generator script based on git-config info
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#
@makevoid
makevoid / passwd
Created July 5, 2010 21:51
SVN: create repository
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
#username=password
@makevoid
makevoid / ubuntu server configuration.sh
Created August 20, 2010 00:55
Ubuntu server configuration
# install AFP
# from: http://ubuntuforums.org/showthread.php?t=410274
mkdir -p ~/src/netatalk
cd ~/src/netatalk
sudo aptitude install devscripts cracklib2-dev dpkg-dev libssl-dev
apt-get source netatalk
sudo apt-get build-dep netatalk
# this folder name may change depending on the version of netatalk
cd netatalk-2.0.5
@makevoid
makevoid / debug_javascript_element.js
Created August 26, 2010 12:14
debug javascript element
function debugg_multiple(elements, attrs) {
if (attrs == undefined)
attrs = [];
string = "";
for (var i = elements.length - 1; i >= 0; i--){
string = string + debugg(elements[i], attrs) + "<br>";
};
return string;
}
@makevoid
makevoid / serve_static_pages_at_almost_rack_speed_rails3.rb
Created September 23, 2010 02:19
Serve static pages at almost rack speed - rails3
class PagesController < ActionController::Metal
include AbstractController::Layouts
include ActionController::Rendering
append_view_path "#{Rails.root}/app/views"
layout "application"
def about
render :about
end
@makevoid
makevoid / emulate_tree_only_dirs.rb
Created September 25, 2010 03:50
emulate tree (only dirs)
def entries(dir)
Dir.entries(dir) - ["..", "."]
end
def entries_map(directory, level=1, &block)
entries(directory).map do |dir|
if File.directory? "#{directory}/#{dir}"
puts "#{">"*level} #{dir}"
block.call "#{directory}/#{dir}"
end
@makevoid
makevoid / border_radius_mixins.haml
Created September 27, 2010 12:27
border radius mixins for cross platform border radius
// mixins
=border-radius(!radius)
border-radius = !radius
-moz-border-radius = !radius
-webkit-border-radius = !radius
=border-radius-bottom(!radius)
-moz-border-radius-bottomleft= !radius
-moz-border-radius-bottomright= !radius
-webkit-border-bottom-left-radius= !radius
@makevoid
makevoid / install rubycocoa over rvm's 1.8.7.sh
Created November 10, 2010 05:19 — forked from thibaudgg/install rubycocoa over rvm's 1.8.7
install rubycocoa over rvm's 1.8.7
# v 1.0.1
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.1/RubyCocoa-1.0.1.tar.gz/download
~$ tar xzf RubyCocoa-1.0.1.tar.gz && rm RubyCocoa-1.0.1.tar.gz && cd RubyCocoa-1.0.1
~/RubyCocoa-1.0.1$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.1$ ruby install.rb setup
~/RubyCocoa-1.0.1$ sudo ruby install.rb install
@makevoid
makevoid / thorrents_search_results.json
Created March 19, 2011 13:50
Thorrents example search results (the real results returned are more)
{
"results": [{
"name": "ubuntu desktop 10.10 i386",
"magnet": "magnet:?xt=urn:btih:bcf2e587afd4d3....80%2Fannounce",
"seeds": "157"
}, {
"name": "Ubuntu 10.10 amd64",
"magnet": "magnet:?xt=urn:btih:4af6fb7cbfb87....80%2Fannounce",
"seeds": "63"
}, {