Skip to content

Instantly share code, notes, and snippets.

View jamescook's full-sized avatar
🏠
Working from home

James Cook jamescook

🏠
Working from home
View GitHub Profile
document.observe("dom:ready", function()
{
var images = $$('img'); // img should replaced with a selector, like img.thumbnail
images.each( function(img)
{
Event.observe(img, 'mouseover', function()
{
console.log("yarrr");
$('my-image-placeholder').setAttribute('src', 'the-image-location.png');
-($:~/rails/insight-card-services)(master)-- curl -X POST --basic -u james-admin:isotope http://localhost:3002/api/v1/card_loads -d 'account_number=1234567890&amount=55&store_id=349'
<?xml version="1.0" encoding="UTF-8"?>
<card>
<account-number>c9d95d44fac48699b23477e3c765e349a25c59d0</account-number>
<balance type="decimal">80.0</balance>
<created-at type="datetime">2009-06-02T19:36:41Z</created-at>
<credit-limit type="integer">200</credit-limit>
<id type="integer">6490</id>
<is-instant-issue type="boolean">true</is-instant-issue>
Card.transaction do
#TODO
if @card.participating_in_top_up_program? # How do we store this?
top_up_amount = (options[:available_balance] - options[:transaction_amount]).abs
# ... magic step where we record the top up/ do special stuff. Does it need to show up in load reports? A different report?
result.success!
return {:pan => options[:account_number], :status => "00", :credit_advance => top_up_amount}
else
result.success!
return {:pan => options[:account_number], :status => "51", :credit_advance => 0.00}
@addon_products = @card.person.account_addon_products.map{|product| product.type.to_s }
in view:
%td.cardholder-product
= @addon_products.to_sentence
people = Person.with_status_code_not_as("Pending Federal Benefits Direct Deposit Credit")
people.each do |p|
next if p.direct_deposit_status.direct_deposit_status_code.to_s == "Rejected"
if !p.federal_benefits_enrollments.empty?
p.direct_deposit_status.change_status!("Pending Federal Benefits Direct Deposit Credit", p.direct_deposit_status.created_by, nil)
end
end
def makeProgress(i, t)
percent = (Float(i) / Float(t)) * 100
percent = (( percent / 5).round * 5).to_i
number_of_bars = percent / 5
progress = "B"
for g in 0..number_of_bars do
progress = progress + "="
end
if number_of_bars > 0
progress = progress + "D"
=> "opening connection to reddit.local...\nopened\n<- \"POST /api/distinguish/yes HTTP/1.1\\r\\n
Cookie: reddit_session=1%2C2010-09-30T18%3A24%3A31%2Cd52e6330abc2f575183926c5de905415eb0c6308; Domain=reddit.local; Path=/\\r\\nUser-Agent: Ruby Reddit Client v0.0.1\\r\\n
Connection: close\\r\\n
Host: reddit.local\\r\\n
Content-Length: 60\\r\\n
Content-Type: application/x-www-form-urlencoded\\r\\n
\\r\\n
\"\n<- \"id=t1_d8&uh=reddit&r=reddit_test0&executed=distinguishing...\"\n-> \"HTTP/1.0 403 FORBIDDEN\\r\\n\"\n->
class ActiveRecordBase extends Backbone.Model
url: "/"
fields: []
toJSON: () ->
@attributes.authenticity_token = @token()
return _.clone(@attributes)
fill: (selector) ->
form = jQuery(selector)
class AllowOriginMiddleware(object):
"""
Sets 'Access-Control-Allow-Origin'
"""
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
def custom_start_response(status, headers, exc_info = None):
origin_header = ["Access-Control-Allow-Origin", "*"]
--($:~/work/subtle)-- hg diff -g Rakefile
diff --git a/Rakefile b/Rakefile
--- a/Rakefile
+++ b/Rakefile
@@ -20,15 +20,17 @@
#
# Options / defines {{{
@options = {
- "destdir" => "",
- "prefix" => "/usr",