Skip to content

Instantly share code, notes, and snippets.

🚀
Hacking

Owen Ou jingweno

🚀
Hacking
Block or report user

Report or block jingweno

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
@jingweno
jingweno / failing_test_for_step_exp
Created Jul 20, 2012
failing_test_for_step_exp
View failing_test_for_step_exp
java.lang.ArrayIndexOutOfBoundsException: 0
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at org.objectweb.asm.tree.ClassNode.accept(Unknown Source)
at me.qmx.jitescript.JiteClass.toBytes(JiteClass.java:151)
at org.dynjs.compiler.DynJSCompiler.defineClass(DynJSCompiler.java:160)
at org.dynjs.compiler.DynJSCompiler.compile(DynJSCompiler.java:150)
@jingweno
jingweno / type_checking.clj
Created Apr 28, 2012
Show case of Clojure's powerful meta-programming system
View type_checking.clj
user=> (defn type_checking [^String s] (.toUpperCase s))
#'user/type_checking
user=> (type_checking 12)
ClassCastException java.lang.Long cannot be cast to java.lang.String user/type_checking (NO_SOURCE_FILE:43)
user=> (defn no_type_checking [s] (.toUpperCase s))
#'user/no_type_checking
user=> (no_type_checking 12)
IllegalArgumentException No matching field found: toUpperCase for class java.lang.Long clojure.lang.Reflector.getInstanceField (Reflector.java:271)
@jingweno
jingweno / error
Created Feb 23, 2012
error when installing posix-spawn gem with JRuby 1.6.7
View error
Installing posix-spawn (0.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Owen/.rvm/rubies/jruby-1.6.7/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
creating Makefile
make
cc -I. -I/Users/Owen/.rvm/rubies/jruby-1.6.7/lib/native/include -I/Users/Owen/.rvm/rubies/jruby-1.6.7/lib/native/include/ruby -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fPIC -DTARGET_RT_MAC_CFM=0 -fno-omit-frame-pointer -fno-strict-aliasing -fexceptions -Wall -arch i386 -c posix-spawn.c
View start_command
/usr/bin/jsvc -home /usr/lib/jvm/java-6-openjdk/jre -wait 20 -pidfile /data/partner-mdm/shared/pids/trinidad.pid -user ubuntu -procname jsvc-trinidad -jvm server -outfile /data/partner-mdm/shared/log/trinidad.log -errfile &1 -cp /home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/ruby/gems/1.8/gems/trinidad_init_services-1.1.2/trinidad-libs/jruby-jsvc.jar:/home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/ruby/gems/1.8/gems/trinidad_init_services-1.1.2/trinidad-libs/commons-daemon.jar:/home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/jruby.jar -Djna.boot.library.path=/home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/native/linux-i386:/home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/native/linux-amd64 -Djffi.boot.library.path=/home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/native/i386-Linux:/home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/native/s390x-Linux:/home/ubuntu/.rbenv/versions/jruby-1.6.6/lib/native/x86_64-Linux -Djruby.shell=/bin/sh -Djruby.home=/home/ubuntu/.rbenv/versions/jruby-1.6.6 -Djruby.lib=/home/ubuntu/.rbenv/versions/jruby-1
@jingweno
jingweno / jruby-openssl_failed_specs
Created Feb 14, 2012
jruby-openssl failed specs
View jruby-openssl_failed_specs
1) Error:
test_bit_string_infinite_length(OpenSSL::TestASN1):
NameError: uninitialized constant OpenSSL::ASN1::EndOfContent
org/jruby/RubyModule.java:2626:in `const_missing'
/Users/Owen/workspace/jruby-ossl/test/1.9/test_asn1.rb:519:in `test_bit_string_infinite_length'
org/jruby/RubyBasicObject.java:1694:in `__send__'
/Users/Owen/workspace/jruby-ossl/test/../build_lib/mocha/lib/mocha/integration/mini_test/version_142_and_above.rb:27:in `run'
2) Failure:
test_cons_explicit_tagging(OpenSSL::TestASN1) [/Users/Owen/workspace/jruby-ossl/test/1.9/test_asn1.rb:408]:
@jingweno
jingweno / sudoers
Created Sep 30, 2011
CMND Alias for Ngninx
View sudoers
Cmnd_Alias DEVSERVER = /opt/nginx/sbin/nginx, /bin/kill
mdesrosiers ALL = NOPASSWD: DEVSERVER
@jingweno
jingweno / active_record_store.rb
Created Sep 27, 2011
Comparison between the DataMapper gem and the ActiveRecord gem
View active_record_store.rb
class Store < ActiveRecord::Base
has_many :products
belongs_to :user
validates_presence_of :name
end
> Store.create(:name => "Amazon")
> Store.where(:name => "Amazon")
View redis_pubsub_demo.rb
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
View tableless_columns.rb
class User < ActiveRecord::Base
include TablelessColumns
tableless_column :license_accepted, :boolean
# other fields that are corresponding to table columns
end
module TablelessColumns
def self.included(base)
You can’t perform that action at this time.