Skip to content

Instantly share code, notes, and snippets.

@rubiii
rubiii / chk
Last active August 29, 2015 13:56
check whether a certain project name is available as a gem or npm package
#!/usr/bin/env ruby
require 'httpclient'
require 'json'
class Chk
RUBYGEMS_URL = 'http://rubygems.org/gems/%s'
NPM_URL = 'https://npmjs.org/package/%s'
@rubiii
rubiii / latest
Created February 5, 2014 18:01
tells you the latest version number of a gem
#!/usr/bin/env ruby
require 'httpclient'
require 'json'
if ARGV.any?
gems = ARGV
else
puts 'feed me some gem name(s)!'
exit
@rubiii
rubiii / keybase.md
Created June 13, 2014 13:08
keybase proof

Keybase proof

I hereby claim:

  • I am rubiii on github.
  • I am rubiii (https://keybase.io/rubiii) on keybase.
  • I have a public key whose fingerprint is A16E 8BE9 0170 59BF FC7B 5041 33B6 0CF6 F240 DD49

To claim this, I am signing this object:

@rubiii
rubiii / heredoc.rb
Created July 3, 2014 21:51
heredoc example. for the next time i forget the syntax.
ERB.new(<<MSG).result(binding)
Blah
ID CODE
--------------------------------------------------------
<% @codes.each do |id, code| %>
<%= id.ljust(20) %> <%= code %>
<% end %>
Blah
MSG
25.07.2009 14:15:26 org.apache.catalina.core.ApplicationContext log
SCHWERWIEGEND: unable to create shared application instance
org.jruby.rack.RackInitializationException: Invalid callback parameter type: STRING
from file:/home/tomcat/tomcat/webapps/nokotest/WEB-INF/lib/jruby-complete-1.3.1.jar!/ffi/library.rb:50:in `attach_function'
from file:/home/tomcat/tomcat/webapps/nokotest/WEB-INF/lib/jruby-complete-1.3.1.jar!/ffi/library.rb:48:in `each'
from file:/home/tomcat/tomcat/webapps/nokotest/WEB-INF/lib/jruby-complete-1.3.1.jar!/ffi/library.rb:48:in `attach_function'
from /home/tomcat/tomcat/webapps/nokotest/WEB-INF/gems/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:138
from /home/tomcat/tomcat/webapps/nokotest/WEB-INF/gems/gems/nokogiri-1.3.2-java/lib/nokogiri/ffi/libxml.rb:31:in `require'
from file:/home/tomcat/tomcat/webapps/nokotest/WEB-INF/lib/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require
$ irb1.9
irb(main):001:0> class Foo; end
=> nil
irb(main):002:0> foo = Foo.new
=> #<Foo:0x0000010107cd38>
irb(main):003:0> def foo.bar; 'foobar'; end
=> nil
irb(main):004:0> foo.bar
=> "foobar"
irb(main):005:0> Foo.new.bar
module Harmony
# Allows accessing config variables from harmony.yml like so:
# Harmony[:domain] => harmonyapp.com
def self.[](key)
unless @config
raw_config = File.read(RAILS_ROOT + "/config/harmony.yml")
@config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
end
@config[key]
end
Rails CMS alternatives
======================
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
"the cutting edge Rails CMS platform"
@rubiii
rubiii / gist:255105
Created December 12, 2009 22:16 — forked from locks/app.rb
require 'rubygems'
require 'savon'
require 'sinatra'
#Savon::SOAP.version = 2
servico = "http://dot.dei.isep.ipp.pt/060516/dir3/srvARQSI45.asmx?wsdl"
get '/' do
client = Savon::Client.new servico
@rubiii
rubiii / url_dsl.rb
Created December 14, 2009 19:00 — forked from defunkt/url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json