Skip to content

Instantly share code, notes, and snippets.

# Kivanio Barbosa
# Class to remove or install gems
class Phoda
attr_accessor :command
attr_accessor :file
attr_accessor :sudo
def initialize(command,file,sudo=false)
raise "Need some existent File." unless File.exist?(file)
@file = file
# This is a code example for the Ruby HTTP library Typhoeus
# here's an example for twitter search
# Including Typhoeus adds http methods like get, put, post, and delete.
# What's more interesting though is the stuff to build up what I call
# remote_methods.
class Twitter
include Typhoeus
remote_defaults :on_success => lambda {|response| JSON.parse(response.body)},
:on_failure => lambda {|response| puts "error code: #{response.code}"},
Shoes.setup do
gem 'activeresource'
end
require 'activeresource'
class Person < ActiveResource::Base
self.site = 'http://0.0.0.0:3000'
end
@deminew
deminew / arf.rb
Created May 22, 2009 21:28 — forked from devyn/arf.rb
class ARF
attr :coords
def initialize map, follow, size, app
@map, @follow, @size, @app, @coords = (map.is_a?(Array) ? map : [map]), follow, size, app, [follow.left,follow.top]
@vx, @vy = 0,0 # velocity
animate_loop
end
def [](x,y)
@coords[0] += x
@coords[1] += y
@deminew
deminew / ipod touch
Created October 14, 2009 16:45 — forked from maca/ipod touch
require 'sinatra'
require 'pathname'
get %r{^(?!/files)(.+$)} do |path|
dir = './public/files' + path
pass unless File.exists?(dir)
@links = Dir[ dir + '*' ].map do |file|
url = file.gsub %r{^\./public}, ''
file_link( File.directory?( file ) ? url.gsub( %r{^/files}, '' ) + '/' : url )
end
class App < Sinatra::Base
before do
headers "Content-Type" => "text/html; charset=utf-8"
end
get '/?' do
"Hello World from App"
end
end
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests