Skip to content

Instantly share code, notes, and snippets.

@danlucraft
danlucraft / extract.rb
Last active August 26, 2022 17:20
Extract annotations from PDFs with pdf-reader gem
require 'pdf-reader'
require './markup_receiver'
doc = PDF::Reader.new(ARGV[0])
$objects = doc.objects
def is_note?(object)
object[:Type] == :Annot && [:Text, :FreeText].include?(object[:Subtype])
end
@danlucraft
danlucraft / scrape-starred-posts.rb
Last active December 14, 2015 22:39
A script to scrape all your starred posts from Google Reader (including post content). I downloaded 3100 blog posts starred over the last 5 years.
# Script to download starred posts from Google Reader (including post content).
# Requires that your starred posts are in a public feed.
#
# You can find the public feed by going to "Reader settings", then "Folders and Tags",
# setting "starred items" to public and then going to "view public page". That url is the
# one to pass to the script.
#
# I guess it would work for other folders too.
#
# Usage:
Windows 95? No problem. Nice new 32 bit API, but it still ran old
16 bit software perfectly. Microsoft obsessed about this, spending
a big chunk of change testing every old program they could find with
Windows 95. Jon Ross, who wrote the original version of SimCity for
Windows 3.x, told me that he accidentally left a bug in SimCity
where he read memory that he had just freed. Yep. It worked fine on
Windows 3.x, because the memory never went anywhere. Here's the amazing
part: On beta versions of Windows 95, SimCity wasn't working in testing.
Microsoft tracked down the bug and added specific code to Windows 95 that
looks for SimCity. If it finds SimCity running, it runs the memory
redcar (gems) $ cat bin/redcar_test
#!/bin/sh
echo "foo"
redcar (gems) $ cat $(which redcar_test)
$ gem install redcar-dev --pre
Fetching: swt-0.3-java.gem (100%)
Fetching: redcar-javamateview-0.1-java.gem (100%)
Fetching: redcar-bundles-0.1-java.gem (100%)
Fetching: rubyzip-0.9.4.gem (100%)
Fetching: lucene-0.5.0.beta.1.gem (100%)
Fetching: bouncy-castle-java-1.5.0146.1.gem (100%)
Fetching: plugin_manager-1.2.gem (100%)
Fetching: jruby-openssl-0.7.4.gem (100%)
Fetching: json-1.5.1-java.gem (100%)
redcar-clojure (master) $ git remote rm origin
redcar-clojure (master) $ git remote add origin git@github.com:danlucraft/redcar-clojure.git
redcar-clojure (master) $ git remote show origin
fatal: '/data/repositories/1/nw/1b/5f/1d/1882053/1882053.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
# instead of
Preference.build do
preference "Appearance/Tab Theme", :type => :combo do
..
end
end
# how about
class Foo
def self.preferences
Preference.draw do
preference "Appearance/Tab Theme", :type => :combo do
default "Mac Classic"
values ["Mac Classic", "Amy", "BBEdit"]
change do
puts "Theme changed to " + Redcar::Preference.get("Appearance/Tab Theme")
# start work on new feature
git checkout -b my-new-feature
git add .
git commit -m "Implemented awesome new feature"
# push it up to my github account (origin is the remote for my github account)
git push origin my-new-feature
diff --git a/test/test_rake_application.rb b/test/test_rake_application.rb
index 4a99cf6..a0910c9 100644
--- a/test/test_rake_application.rb
+++ b/test/test_rake_application.rb
@@ -321,7 +321,7 @@ class TestRakeApplication < Rake::TestCase
ARGV << '-f' << '-s' << '--rakelib=""'
assert_raises(SystemExit) {
_, err = capture_io { @app.run }
- assert_match(/see full trace/, err)
+ assert_match(/WOOO/, err)