Skip to content

Instantly share code, notes, and snippets.

Martin Kleppmann ept

Block or report user

Report or block ept

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:84014
--- jquery-1.3.2.js 2009-03-23 23:40:44.000000000 +0000
+++ /tmp/jquery-1.3.2.js 2009-03-24 09:14:16.000000000 +0000
@@ -3262,7 +3262,7 @@
data: params,
complete: function(res, status){
// If successful, inject the HTML into all the matched elements
- if ( status == "success" || status == "notmodified" )
+ if ( dUmMy== "success" || dUmMy== "notmodified" )
// See if a selector was specified
self.html( selector ?
View gist:95762
$ newgem .
exists
create doc
create lib
[...]
$ script/generate component_generator mygen rails
create rails_generators/mygen/templates
exists test
create rails_generators/mygen/mygen_generator.rb
View gist:141346
Consuming example queue...
Exception in thread "main" com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.io.EOFException
at com.rabbitmq.client.impl.AMQConnection.shutdown(AMQConnection.java:599)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:461)
Caused by: java.io.EOFException
at java.io.DataInputStream.readUnsignedByte(Unknown Source)
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:117)
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:151)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:288)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:431)
View gist:147625
import java.util.logging.Logger
import com.rabbitmq.client.{AlreadyClosedException, Channel, Connection, ConnectionFactory,
ConnectionParameters, QueueingConsumer, ShutdownSignalException, AMQP}
object RabbitExample {
case class Config(host: String, port: Int)
val config = Config("localhost", 5672)
private val log = Logger.getLogger(this.getClass.getName)
private var connectionFactory: ConnectionFactory = null
View gist:1124644
class BridgeController < ApplicationController
rescue_from YouShallNotPassException, :status => 403, :error_code => 'no_way' do |exception, response|
response[:where] = exception.backtrace.first
end
# Assuming a route like this:
# map.connect "/khazad_dum/bridge/cross", :controller => :bridge, :action => :cross, :format => :json
# then this will return a HTTP 403 error with the following JSON object as body:
# {"error_code": "no_way", "message": "No balrogs past this point please",
# "where": "bridge_controller.rb:12:in `cross'"}
@ept
ept / failure
Created Aug 11, 2011
Exceptions in Neo4j.rb (1.1.4)
View failure
jruby-1.6.3 :001 > require 'rubygems'
=> true
jruby-1.6.3 :002 > require 'neo4j'
=> true
jruby-1.6.3 :003 > inserter = Neo4j::Batch::Inserter.new
=> #<Neo4j::Batch::Inserter:0xd713fe @rule_inserter=#<Neo4j::Batch::RuleInserter:0x4936f3 @inserter=#<Neo4j::Batch::Inserter:0xd713fe ...>>, @batch_inserter=#<Java::OrgNeo4jKernelImplBatchinsert::BatchInserterImpl:0x118abfe>>
jruby-1.6.3 :004 > node_a = inserter.create_node('name' => 'andreas')
=> 1
jruby-1.6.3 :005 > node_c = inserter.create_node('name' => 'craig')
=> 2
@ept
ept / qrupdate.log
Created Aug 28, 2011
brew install qrupdate
View qrupdate.log
==> Downloading http://downloads.sourceforge.net/qrupdate/qrupdate-1.1.1.tar.gz
File already downloaded in /Users/martin/Library/Caches/Homebrew
/usr/bin/tar xf /Users/martin/Library/Caches/Homebrew/qrupdate-1.1.1.tar.gz
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> make -j 1 install
make -j 1 install
/usr/local/bin/gfortran -O3 -march=core2 -msse4.1 -w -pipe -fPIC -c caxcpy.f
/usr/local/bin/gfortran -O3 -march=core2 -msse4.1 -w -pipe -fPIC -c cch1dn.f
/usr/local/bin/gfortran -O3 -march=core2 -msse4.1 -w -pipe -fPIC -c cch1up.f
View Podfile
platform :ios
dependency 'JSONKit'
dependency 'ASIHTTPRequest'
@ept
ept / gist:2838935
Created May 30, 2012
Make Storm use exec instead of forking a child for the JVM (patch for 0.7.1 release)
View gist:2838935
--- a/bin/storm 2012-05-30 19:57:54.265944289 +0000
+++ b/bin/storm 2012-05-30 20:36:25.516040172 +0000
@@ -82,12 +82,15 @@
"""
print name + ": " + confvalue(name, [STORM_DIR + "/conf"])
-def exec_storm_class(klass, jvmtype="-server", childopts="", extrajars=[], args=[]):
- nativepath = confvalue("java.library.path", extrajars)
- args_str = " ".join(map(lambda s: "\"" + s + "\"", args))
- command = "java " + jvmtype + " -Dstorm.home=" + STORM_DIR + " " + get_config_opts() + " -Djava.library.path=" + nativepath + " " + childopts + " -cp " + get_classpath(extrajars) + " " + klass + " " + args_str
@ept
ept / gist:2920086
Created Jun 12, 2012
Ratio of mean to median household income, by country (2004)
View gist:2920086
Ratio of mean to median household income, by country (2004)
Country Mean Median Currency Mean greater by
United Kingdom 16,685 13,637 British Pound 22.4%
United States 32,195 26,672 United States Dollar 20.7%
Italy 15,835 13,367 Euro 18.5%
Poland 14,844 12,697 Polish złoty 16.9%
Australia 29,417 25,581 Australian Dollar 15.0%
Canada 33,785 29,394 Canadian Dollar 14.9%
You can’t perform that action at this time.