This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enable or reset Disqus for this page as required, with optional SSO. | |
// There must be a div with id "disqus_thread" when called. | |
// | |
// config is required and should have the format: | |
// | |
// { | |
// shortname: "..", | |
// title: "..", | |
// identifier: "..", | |
// url: ".." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inlines: { | |
link: { | |
// No link should be present but empty (default normalize should remove | |
// it if this returns false). | |
text: function(string) { | |
return string.length !== 0 | |
}, | |
// If the text node after a link inline is empty... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PIXEL_WIDTH = 160 | |
var PIXEL_HEIGHT = 120 | |
var WIN_WIDTH = window.innerWidth | |
var WIN_HEIGHT = window.innerHeight | |
var ratio_width = WIN_WIDTH / PIXEL_WIDTH | |
var ratio_height = WIN_HEIGHT / PIXEL_HEIGHT | |
var pixel_size = Math.floor(Math.min(ratio_width, ratio_height)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'jruby/profiler' | |
profile_data = JRuby::Profiler.profile do | |
# code to be profiled.... | |
end | |
my_output_stream = java.io.ByteArrayOutputStream.new | |
print_stream = java.io.PrintStream.new(my_output_stream) | |
profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.DesignsRoute = Ember.Route.extend({ | |
setupController: function(controller) { | |
controller.set("model", App.Design.findAll()); | |
} | |
}); | |
App.DesignsController = Ember.ArrayController.extend({ | |
sortProperties: ["name"], | |
sortAscending: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VCR.configure do |v| | |
v.register_request_matcher :json_aware_body do |r1, r2| | |
r1.body == r2.body || ( | |
r1.headers["Content-Type"].inspect =~ /json/ and JSON.parse(r1.body) == JSON.parse(r2.body)) | |
end | |
end | |
VCR.use_cassette('example', :match_requests_on => [:json_aware_body]) do | |
#... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd workspaces/geoip-service | |
rm -rf tmp | |
rm -rf src/geoip-service | |
rm -f geoip-service | |
mkdir tmp | |
mv src/* tmp/ | |
mkdir src/geoip-service | |
mv tmp/* src/geoip-service/ | |
echo $PWD | |
export GOPATH=$PWD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
# Show what return in a block does to return values and code after the block is run | |
class TestReturn < Minitest::Unit::TestCase | |
def setup | |
@post_code_run = false | |
end | |
# Method under test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
NewerOlder