Skip to content

Instantly share code, notes, and snippets.

View oddlyzen's full-sized avatar
:electron:
Working with Electron

Mark Coates oddlyzen

:electron:
Working with Electron
View GitHub Profile
# wadl.rb
# http://www.crummy.com/software/wadl.rb/
# Super cheap Ruby WADL client
# by Leonard Richardson leonardr@segfault.org
# v20070217
# For more on WADL, see http://wadl.dev.java.net/
require 'rubygems'
require 'rest-open-uri'
[1:46am] <bitpimpin> !task Again.
[1:46am] <lurch_bot> A task ('Again.') was created at Tue Mar 24 01:46:41 -0400 2009. <ID:8957300>
[1:46am] <bitpimpin> !tag 8957300 test,this,out
[1:46am] <lurch_bot> Found object <8957300>:
[1:46am] <lurch_bot> Tagged! Test
[1:46am] <lurch_bot> Tagged! This
[1:46am] <lurch_bot> Tagged! Out
[1:47am] <bitpimpin> !tasks
[1:47am] <lurch_bot> <ID:8957300>(Again.): 27.233957 seconds | Tagged: test, this, out.
[1:47am] <bitpimpin> !tasks
@oddlyzen
oddlyzen / snippet.rb
Created March 24, 2009 05:00 — forked from anonymous/snippet.rb
Interesting little brain fart.
def speed_bump(&block)
sleep(1)
yield
sleep(1)
end
@oddlyzen
oddlyzen / gist:83685
Created March 23, 2009 17:57
A simple IRC bot.
#!/usr/local/bin/ruby
# Attributed to user 413x from rubystuff.org
require "socket"
# Don't allow use of "tainted" data by potentially dangerous operations
$SAFE=1
# The irc class, which talks to the server and holds the main event loop
# for multiline ruby statements in haml...
= { :foo => :bar, |
:baz => :foo, |
:quux => :zz}.inspect |
# the magical 'pipe' strikes again.
namespace :rdoc do
desc "Generate RDocs for ZepInvest (exluding RESTful Authentication Plugin)"
task :generate do
`rdoc --exclude restful_authentication -o zepdocs ; open zepdocs/index.html`
end
desc "Remove old docs and regenerate RDocs for ZepInvest (exluding RESTful Authentication Plugin)"
task :regenerate do
`rm -rf zepdocs`
def serialize_to_json(options={})
namespace = options[:namespace].nil? ? 'ZEP' : options[:namespace]
if options[:data]
list = options[:data]
js = ""
js << "<script type=\"text/javascript\">"
js << "\n\tif (typeof #{namespace} !== 'object') { var #{namespace} = {}; }\n"
js << "\n\tif (typeof #{namespace}.models !== 'object') { #{namespace}.models = {}; }\n"
list.each do |obj|
if obj.respond_to? :to_json
@oddlyzen
oddlyzen / gist:67384
Created February 20, 2009 08:58
Permutation of a Tweet.
Electrons flush into infinity & a hot robot hibernates: to dream of electric foos, to become digital meme in analog shell.
@oddlyzen
oddlyzen / gist:67320
Created February 20, 2009 05:02
An example of Russian to English and English to Russian using Mibbit's translator tool. Check out the last lines of each transcript for the real coolness.
(in mibbit.com/Firefox)
You are now sending with translation to English
You are now receiving with translation to Russian
23:27 bitpimpin hello. (hello.)
You are now sending with translation to Russian
23:28 bitpimpin This is a test. (Это тест.)
23:28 bitpimpin Hello. (Здравствуйте.)
You are now receiving with translation to English
23:28 bitpimpin Test (Проверка)
23:28 bitpimpin Okay, if this actually works, this is OMG universal translator (Хорошо, если это действительно работает, это OMG универсальный переводчик)
# Cron jobs start here --------------------------------------------------------------
def self.check_trial
accounts = BillingAccount.find(:all, :include => :user, :conditions => ["kind = 'trial' and status = 'active'"])
accounts.each do |a|
if a.expires_at.to_s == Time.today.strftime("%Y-%m-%d")
pay_me = execute_payment(:customer_profile_id => a.customer_profile_id, :customer_payment_profile_id => a.customer_payment_profile_id, :user_id => a.user_id)
if pay_me.success?
a.kind = "full"
a.expires_at = 1.year.from_now
a.save!