Skip to content

Instantly share code, notes, and snippets.

Flashcard Architecture

Models

  • Deck
  • Card
  • Answer

I want to select the cards for a given deck that have been answered the longest ago.

--(jadams@viggyviggy)-(23/pts/1)-(1124/23-Apr-12)--
--($:~/projects/USPTO_dir_api)(master)--
$ mvn clean install
[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/com/o19s/uspto/solr/solr_service_pom/1.0/solr_service_pom-1.0.pom
[ERROR] The build could not read 3 projects -> [Help 1]
[ERROR]
[ERROR] The project com.o19s.uspto.solr:solr_service:1.0 (/home/jadams/projects/USPTO_dir_api/ejb/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact com.o19s.uspto.solr:solr_service_pom:pom:1.0 in central (http://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 7, column 13 -> [Help 2]
[ERROR]
--(jadams@viggyviggy)-(36/pts/1)-(1150/23-Apr-12)--
--($:~/projects/USPTO_dir_api)(master)--
$ mvn clean install
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com/o19s/uspto/solr/solr_service_pom/1.0/solr_service_pom-1.0.pom
[INFO] Unable to find resource 'com.o19s.uspto.solr:solr_service_pom:pom:1.0' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
@knewter
knewter / 01_script_output
Created April 24, 2012 02:19
Issue I'm having with celluloid and FSM
jruby-1.6.7 :002 > require './person'
=> true
jruby-1.6.7 :003 > p=Person.new 'Kristen'
=> <Person @name=Kristen @age=0>
jruby-1.6.7 :004 > p.machine
=> #<Person::Machine:0x1f48b272 @state=:living, @actor=<Person @name=Kristen @age=0>>
jruby-1.6.7 :005 > p.machine.transition(:aging)
=> nil
jruby-1.6.7 :006 > p.machine
=> #<Person::Machine:0x1f48b272>
jruby-1.6.7Error-opening :008 > DCell::Explorer.new("127.0.0.1", 8000)
=> #<Celluloid::Actor(DCell::Explorer:0xd12) @callback=#<Proc:0x1a06f956@/home/jadams/.rvm/gems/jruby-1.6.7@dcell-test/gems/dcell-0.10.0/lib/dcell/explorer.rb:18 (lambda)> @server=#<Celluloid::IO::TCPServer:0x3fdb8a73 @server=#<TCPServer:fd 57>>>
jruby-1.6.7Error-opening :009 > /home/jadams/.rvm/gems/jruby-1.6.7@dcell-test/gems/dcell-0.10.0/explorer/index.html
I, [2012-04-25T17:52:59.150000 #11868] INFO -- : 200 OK: /index.html
/home/jadams/.rvm/gems/jruby-1.6.7@dcell-test/gems/dcell-0.10.0/explorer/css/bootstrap.css
E, [2012-04-25T17:52:59.211000 #11868] ERROR -- : DCell::Explorer crashed!
NoMethodError: undefined method `length' for #<File:0x1ff61bcf>
/home/jadams/.rvm/gems/jruby-1.6.7@dcell-test/gems/reel-0.0.1/lib/reel/response.rb:23:in `initialize'
/home/jadams/.rvm/gems/jruby-1.6.7@dcell-test/gems/reel-0.0.1/lib/reel/connection.rb:78:in `respond'
/home/jadams/.rvm/gems/jruby-1.6.7@dcell-test/gems/dcell-0.10.0/lib/dcell/explorer.
NameError at /render/
global name 'divisor' is not defined
Request Method: GET
Request URL: http://stats.example.com/render/?width=586&height=308&_salt=1335722102.654&target=stats.dashboard.index&title=Dashboard%20Views
Django Version: 1.3.1
Exception Type: NameError
Exception Value:
global name 'divisor' is not defined
Exception Location: /opt/graphite/webapp/graphite/render/glyph.py in consolidateDataPoints, line 939
Python Executable: /usr/bin/python
@knewter
knewter / gist:2710137
Created May 16, 2012 12:55
problems converting images with qemu
So I have a disk image, and I'm trying to convert it to a raw image. It never gave me grief before, but when I try to do the conversion I get an error:
sudo qemu-img convert -f qcow2 -O raw ./instance-0000000a/disk jenkins-attempt-1
> qemu-img: error while reading sector 10203136: Input/output error
Alright, so I checked the disk to see if I got the same error with qemu-io:
sudo qemu-io -c "read -v $((10203136 * 512)) 65536" ./instance-0000000a/disk
And that gives me:
Jul 23, 2012 3:52:35 PM hudson.triggers.SCMTrigger$Runner run
INFO: SCM changes detected in mayhem. Triggering #5
getConfigPage -> /rvm_wrapper/config
getConfigPage -> /rvm_wrapper/config
instance created: #<RvmWrapper:0x782330d8> (hudson.tasks.BuildWrapper)
Jul 23, 2012 3:57:05 PM hudson.plugins.bruceschneier.CordellWalkerRecorder <init>
INFO: Bruce Schneier is activated
Jul 23, 2012 3:57:06 PM hudson.model.Run run
INFO: mayhem #4 aborted
java.lang.InterruptedException

Spree Checkout Fakery

We want to use spree to manage inventory/products, but our app uses funny money and needs to override checkout.

Ordering a product is a one-step process. Click a button, order fulfilled. My plan is as follows:

On button click:

  • Create a cart.
  • Add the product to the cart.
  • Specify my own address bits to handle fulfilment.
  • Push the order through all of its state machine, step by step. I won't skip any, I'll just do them all in one action. (this will be in a plain ol' ruby object that handles all of this)
@knewter
knewter / funny_money.rb
Created August 10, 2012 20:04
Funny Moneyz
module Spree
class Gateway::FunnyMoney < Gateway
attr_accessor :test
def provider_class
self.class
end
def preferences
{}