Skip to content

Instantly share code, notes, and snippets.

def on_unsubscribe(incoming)
@payload = incoming.payload
# puts fired_at
# puts action
# puts reason
# puts id
# puts list_id
# puts email
# puts email_type
# puts payload_with_email
@itstommymorgan
itstommymorgan / exclude
Created November 28, 2008 22:30
My .git/info/exclude file, which doesn't seem to be doing anything.
# git-ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
*
.*
!.autotest
!.bash_aliases
require 'autotest/redgreen'
require 'autotest/timestamp'
module Autotest::Naughty
def self.naughty_notify title, text
system "echo \"naughty.notify({title='#{title}', text='#{text}', timeout=10})\" | awesome-client -"
end
Autotest.add_hook :red do |at|
errors = at.files_to_test.map { |k, v| "#{k}:\n #{v.join("\n ")}"}.join("\n\n")
#!/bin/sh
HOST=cdmwebs.homedns.org
SOURCE=/Users/chris
INCLUDE=/Users/chris/bin/include.txt
PATHTOBACKUP=/media/storage/backups/panthera
PID=`pidof -s /bin/sh /Users/chris/bin/time_machine.sh`
# No more changes.
#!/usr/bin/env ruby
module ValidatedAccessor
# Usage:
#
# class Foo
# include ValidatedAccessor
# attr_validated_accessor(:bar, :baz) { |x| x.between? 1, 10 }
# end
Things to do on Zoidberg day:
- Apply for those mail-order degrees in murderology and murderometry that you've
always wanted.
- Go hunting for guinea pigs.
- Put on your formal shell and have a fancy party.
- Experiment with bodily secretions-as-jewelry. It could be a big hit!
## What I'm talking about.
class TestClass
# calling instance methods (public or private) works just fine
# if you don't use an explicit self.
def this_method_works_fine
foo
end
duwanis@localhost ~ $ jirb
irb(main):001:0> JString = java.lang.String
=> Java::JavaLang::String
irb(main):002:0> class JString
irb(main):003:1> def is_monkeypatched?
irb(main):004:2> return true
irb(main):005:2> end
irb(main):006:1> end
=> nil
irb(main):007:0> x = java.lang.String.new("Testing.")
# If I were, say, working on a Swing app in JRuby
# This is code I'd love to be able to write...
main_window.ok_button.when_clicked do |event|
if validate_form
controller.submit_form (form_data)
else
display_error_messages
end
end
class Parent
def foo
puts "I'm a good parent."
end
end
module Interloper
def foo
puts "I've got candy in the van."
end