Skip to content

Instantly share code, notes, and snippets.

View jkassemi's full-sized avatar

James Kassemi jkassemi

View GitHub Profile
require 'rubygems'
require 'httpi' # Use whatever http system you've already started using
require 'json'
require 'openssl'
require 'oj'
class Signature
class << self
def signature(rails_request)
payload = "https://dashboard.atpay.com/email_transactions/" +
### Keybase proof
I hereby claim:
* I am jkassemi on github.
* I am jkassemi (https://keybase.io/jkassemi) on keybase.
* I have a public key whose fingerprint is E7F4 E74B 770F 2674 0B7C 9D8E 45D9 6E63 99C3 1CF0
To claim this, I am signing this object:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQINBFRL/sABEACiG2Bq+GPE5WlfPkHLDvrIRNxlmB6wGEnhchwfvPE63Z5cOlaa
jLs9VqQ6wptIuUpRe9mq7RqBSN5oWBhymo2vZaYM4PfbzZRsBJlbBzjcACQ8BNG1
xSbb1+Ba/Cx449hFxar4khFQBsR2yfB2dTn2YXXirXORPvvReUA0rA3gozCRrh56
ui/u4Y3Qi9NhzsHTxzKvg4cJAjAh30NFO/1urx35d8Pacs3dYZFLvEQ6+hdSFY3X
TbIvHyJ/WiB3BkGCge5hCankyuqPZibzH3907pPvc1+Q/dWY670r8ADIKnXNgGOC
ybO56IZsv+I61bAZJboPOnTAn2/Elv5kpet4+1WaXOfLPEaqAwz/f7dqkwhnvI5a
unQuv185IODOR46JxC1beZO8jAWgzKqDvlmzORiTMARwWxehW38scuM+cmeCRzp6

Keybase proof

I hereby claim:

  • I am jkassemi on github.
  • I am jkassemi (https://keybase.io/jkassemi) on keybase.
  • I have a public key whose fingerprint is 1A60 ADBC 9D51 9E9E 8C99 ECCA 6CAF 0166 3F85 16DA

To claim this, I am signing this object:

@jkassemi
jkassemi / gist:3797001
Created September 27, 2012 23:09
Select2.js capybara
def select2_select(text, options)
page.find("#s2id_#{options[:from]} a").click
page.all("ul.select2-results li").each do |e|
if e.text == text
e.click
return
end
end
end

Description

Dashing widget to show the build status of a CircleCI project.

Usage

  • Get a Circle API Token from your Account Dashboard and set it in your environment as CIRCLE_CI_AUTH_TOKEN
  • Add the httparty to your Gemfile and run bundle install

Then:

@jkassemi
jkassemi / gist:7034805
Created October 18, 2013 00:47
Watch files, make. Easy.
# https://news.ycombinator.com/item?id=6568137
inotifywait -m -e modify,close_write,move,move_self,create,delete,delete_self -r . | while read; do make; done
@jkassemi
jkassemi / gist:7621426
Created November 23, 2013 23:39
Server / Client Form Validation - Reminder
1) Render content for page
2) Parse form contents from page before delivery, parse validation fields, save, sign, inject content
3) Validate signature on validation content on form, validate according to HTML form validation rules.
-----BEGIN PGP MESSAGE-----
Version: GnuPG v2.0.22 (Darwin)
hQIMAw+MY6dm20KGAQ//ZKHiKW1q9Teo3C66GvVV2jPbfyI+XhTKnAnJQe6uHCtn
tNBw8qjbfADGqaEkX/drrWBhLeiuYaE1EzkNj9dxrLy1Z2ZoX8tT8U/uKpyIpZXZ
KBtY++g7vnJJPMJ90f8MEyEqejzggXFjwGkhVaV9e1b1KFq8YOJjLVKd2tGTctia
RZUC2wZGBAGvUcuHxvX4cTKUwENgnNUqZRLLO6X4YvZCtpNdIoxbipFc9ENeZgGw
ApDwOJIDcFVI+dEu661pqUBRok4+dQiQ6PLMNNTIfHQ3898lFuYkrYm2bGA0Z5VK
mSUP4HiYL9zNq0hzRmpDjyccXRhH7pJw5RbGYVEOVetMM86tLZPkul7IbHJ0wErO
MSYw3nZK5lwQPcjMPJugTpzy/f7pPWeK8qthsBX/I71gF0rx9QEatgm5kEEeq6So
@jkassemi
jkassemi / gist:7746307
Created December 2, 2013 07:40
Drone delivery range - RE: Amazon
Given
1) A drone can carry a recharge load for another drone
2) A drone can fly 2*X distance before a recharge
3) A drone must leave point A, reach point B, and return to point A.
If distance AB < X then no recharge is required.
If distance AB == 2X then
Drone 1 flies to <X
Drone 2 flies to <X, charges Drone 1, returns to A