Skip to content

Instantly share code, notes, and snippets.

View stephenroller's full-sized avatar
🗨️

Stephen Roller stephenroller

🗨️
View GitHub Profile
@stephenroller
stephenroller / backexpose.applescript
Created February 2, 2009 18:45
Gives a back button/expose button for the mighty mouse
tell application "System Events" to set appList to name of application processes whose frontmost is true
set frontApp to item 1 of appList
if frontApp is "Safari" then
tell application "System Events" to keystroke "[" using command down
else
-- expose all windows
tell application "System Events" to key code 101
end if
diff -u -N iTrust/httptests/edu/ncsu/csc/itrust/http/DetermineOperationalProfileTest.java iTrust/httptests/edu/ncsu/csc/itrust/http/DetermineOperationalProfileTest.java
--- iTrust/httptests/edu/ncsu/csc/itrust/http/DetermineOperationalProfileTest.java 2009-01-28 04:16:15.000000912 -0500
+++ iTrust/httptests/edu/ncsu/csc/itrust/http/DetermineOperationalProfileTest.java 2009-02-18 02:11:12.000000142 -0500
@@ -47,9 +47,9 @@
assertEquals("0", table.getCellAsText(1, 5));//was 0
assertEquals("0%", table.getCellAsText(1,6));//was 0
//now check the totals are correct
- assertEquals("Totals", table.getCellAsText(36, 0));
- assertEquals("3", table.getCellAsText(36, 1));//was 4
- assertEquals("2", table.getCellAsText(36, 3));//was 3

UC31

  • Added getExpiredPrescriptions to PatientDAO.java
    • Pulls from the DB
  • added getExpiredPrescriptionsForPatient in ViewPrescriptionRecordsAction.java
    • Business logic for UC31
  • Added VIEW_EXPIRED_PRESCRIPTIONS to TransactionType.java (for logging)
  • Added menu item for View My Expired Prescriptions

Unit Tests

import readline
def make_hook(text):
def _hook():
readline.insert_text(text)
readline.redisplay()
return _hook
readline.set_pre_input_hook(make_hook(''))
(ns jnatest)
(import 'com.sun.jna.Library 'com.sun.jna.Native)
(gen-interface
:name JnaTest
:extends [com.sun.jna.Library]
:methods [['getppid [] Integer]
['getpid [] Integer]
['sleep [Integer] Void]])
sr ~/Wo/compojuretest $ cljr
Clojure
1:1 user=> (set! *compile-path* "./")
"./"
1:2 user=> (compile 'jnatest)
jnatest
1:3 user=> (import 'com.sun.jna.Library 'com.sun.jna.Native)
nil
1:4 user=> (import 'JnaTest)
nil
sr ~/Wo/compojuretest $ jad JnaTest.class
Parsing JnaTest.class... Generating JnaTest.jad
sr ~/Wo/compojuretest $ cat JnaTest.jad
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
import com.sun.jna.Library;
public interface JnaTest
### Jazz Patch 1.0
#date: "2009-04-15 23:42:41.000000234 -0400"
#itemid: "iTrust/unittests/edu/ncsu/csc/itrust/dao" "_R3TmkBpGEd6nA98H4Bi_fQ" "_n1RZMBZVEd6JG7OCVhzRHg"
#itemid: "iTrust/src/edu/ncsu/csc/itrust/dao/mysql" "_R5W1ABpGEd6nA98H4Bi_fQ" "_n1RZMBZVEd6JG7OCVhzRHg"
#itemid: "iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java" "_yHEdACPmEd6N8ZDIVCJVWg" "_n1RZMBZVEd6JG7OCVhzRHg"
#itemid: "iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java" "_Tf3D4CR6Ed6RqZ79QsSawQ" "_n1RZMBZVEd6JG7OCVhzRHg"
#before_state: "iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java" "_yHEdACPmEd6N8ZDIVCJVWg" "_Qs43oSn5Ed6JG7OCVhzRHg"
#before_state: "iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java" "_Tf3D4CR6Ed6RqZ79QsSawQ" "_BXc48SmcEd6JG7OCVhzRHg"
#
diff -u -N iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java
@optimization([('LDC', "$A", 2, WILD),
('LD', "$B", 0, SP),
('LDA', SP, 1, SP),
('MUL', "$A", "$B", "$A")])
def times_two(nodes, A, B):
nodes[0].remove()
nodes[1].inst5 = ('LD', A, 0, SP, 'get A off of stack')
nodes[3].inst5 = ('ADD', A, A, A, 'A * 2')
@stephenroller
stephenroller / dynamic.py
Created March 21, 2011 22:23
A generic dynamic programming decorator.
#!/usr/bin/env python
# Generic Dynamic Programming Library
# Just throw @dynamic in front of any method
# to make it dynamic!
import hashlib
def dynamic(func):
vals = {}