Skip to content

Instantly share code, notes, and snippets.

View tenderlove's full-sized avatar
©️
 ​[object Object] :trollface:

Aaron Patterson tenderlove

©️
 ​[object Object] :trollface:
View GitHub Profile
ARGV.each { |email|
next if User.find_by_email email
buzz_team_users = [ 'default@example.org' ]
user_sending_invite = buzz_team_users.rand
user = User.find_by_email user_sending_invite
invitation = Invitation.new
invitation.sent_to_email = email
invitation.sent_by_user_id = user.id
invitation.note = "Hey, we want you to join buzz"
require 'rubygems'
require 'nokogiri'
puts "nokogiri: #{Nokogiri::VERSION}"
puts "libxml: #{Nokogiri::LIBXML_VERSION}"
count = 0
File.open(ARGV[0], "r") do |input|
reader = Nokogiri::XML::Reader(input) { |cfg|
class Fancy
def self.test
puts "Ask me a question:"
t = gets
puts "You said: #{t}"
puts "What about this other thing?"
t2 = gets
puts "Now you said: #{t2}"
end
end
# This is pretty evil, yeah... I know
class Module
end

echo

Usage

require 'echo'

echo("foo msg") > "foofile"
echo("foo msg") >> "foofile"
class SomeClass
def initialize(options = {})
load_config
set_options(options)
end
def load_config
end
def set_options(options)
# heredocs can continue the code on the same line:
class SomeController
def render opts
p opts
end
def setup; false; end
def action_a
###
SUBJECT: About An Imaginary Number Literal (Translation)
This post is the summary of a recent discussion in [ruby-dev] about imaginary numbers.
In [ruby-dev:38843] 複素数リテラルについて http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/38843 ,
Matz suggested introducing an imaginary number literal to ruby. After his new patch is applied, we can use the following syntax:
2i
2.0i
He also showed some issues about:
@tenderlove
tenderlove / ns.html
Created July 12, 2009 20:48 — forked from trek/ns.html
<html xmlns="http://www.w3.org/HTML/1998/html4" xmlns:xdc="http://www.internet.com/custom">
<head></head>
<body>
<p></p>
<xdc:user id='11'>
<div></div>
<foo></foo>
<xdc:name />
</xdc:user>
<xdc:employees />
#!/usr/bin/ruby -w
def ensure_data_file
unless defined? DATA
const_set(:DATA, File.open($PROGRAM_NAME, 'r+'))
DATA.seek 0, IO::SEEK_END
DATA.puts
DATA.puts('__END__')
end
DATA