Skip to content

Instantly share code, notes, and snippets.

View garybernhardt's full-sized avatar

Gary Bernhardt garybernhardt

View GitHub Profile
Date: Thu, 3 Oct 2013 17:16:51 -0700
From: Gary Bernhardt <[email protected]>
To: [email protected]
Subject: Mailing practices
I suspect that you guys know this, but just in case: your emailing
practices have been resulting in... less than good impressions among the
people you aim to recruit. Here are some tweets, none of which were
written by me:
John Carmack on shadow volumes...
I recieved this in email from John on May 23rd, 2000.
- Mark Kilgard
I solved this in a way that is so elegant you just won't believe it. Here
is a description that I posted to a private mailing list:
find ~/Downloads/Gmail -type f | grep -v '\.git' | ruby -rdate -e 'today = Date.today; STDIN.each { |path| content = File.read(path.strip); begin; from = content.grep(/^From:/).fetch(0); date = content.grep(/^Date:/).fetch(0); puts from if Date.parse(date) > today - 365; rescue IndexError; end }' | while read line; do echo "$line" | ~/.mutt/add-aliases.sh; done
thelongpoll: Acquiring lock on /Users/grb/.thelongpoll
thelongpoll: - Got it
thelongpoll: Is the mail client running?
thelongpoll: * ps aux
thelongpoll: - No
thelongpoll: Checking git status
thelongpoll: * (cd /Users/grb/Downloads/Gmail && git status --short)
thelongpoll: - Clean
thelongpoll: Don't need to commit to git
thelongpoll: Starting sync
--- /Users/grb/.rvm/gems/ruby-1.9.3-p194@investments/gems/values-1.5.0/lib/values.rb 2013-06-17 19:28:23.000000000 -0700
+++ values.rb 2013-06-25 17:28:17.000000000 -0700
@@ -1,7 +1,7 @@
class Value
def self.new(*fields)
Class.new do
- attr_reader *fields
+ attr_reader :hash, *fields
define_method(:initialize) do |*values|
diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb
dissimilarity index 99%
index 414904b..0b0b21d 100644
--- a/app/views/devise/shared/_links.erb
+++ b/app/views/devise/shared/_links.erb
@@ -1,19 +1,15 @@
-<%- if controller_name != 'sessions' %>
- <%= link_to "Sign in", new_session_path(resource_name) %><br />
-<% end -%>
-
>> class Foo; attr_accessor :hello; end
>> f = Foo.new
>> f.hello = lambda { puts "why no self?" }
>> f.hello
=> #<Proc:0x0000000102b6e768@(irb):12>
failbowl:~(master) $ irb
>> X = 1
=> 1
>> undef_const :X
NoMethodError: undefined method `undef_const' for main:Object
from (irb):2
>> const_undef :X
NoMethodError: undefined method `const_undef' for main:Object
from (irb):3
>> const_delete :X
failbowl:~(master!?) $ # Curl with normal user agent; get the correct text back
failbowl:~(master!?) $ curl -s 'https://gist.github.com/raw/4534954/b508396cb255b52a0defbc75c92e69ad5c2937b5/gistfile1.rb' | head -1
# I don't really see any services here. What I see is:
failbowl:~(master!?) $ # Curl as iPhone; get broken text back
failbowl:~(master!?) $ curl -s -A 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' 'https://gist.github.com/raw/4534954/b508396cb255b52a0defbc75c92e69ad5c2937b5/gistfile1.rb' | head -1
# I don&#39;t really see any services here. What I see is:
# I don't really see any services here. What I see is:
# - Normal HTTP boundary stuff (params flash, redirect).
# - Model creation and retrieval.
# - Warden manipulation, which is an odd done but smells like boundary.
#
# I left all of the HTTP boundary stuff in the controller (and only the
# controller). I moved the model creation/retrieval into simple class methods
# in the models. I moved the warden manipulation stuff into
# ApplicationController (with caveats that I'll discuss inline).
#