Skip to content

Instantly share code, notes, and snippets.

View jkgraham's full-sized avatar

Jonathan Graham jkgraham

  • Fond Technologies, Inc.
  • Portland, OR
View GitHub Profile
@jkgraham
jkgraham / sublime-settings.json
Last active August 29, 2015 14:10
Sublime settings
{
"font_size": 9,
"tab_size": 2,
"highlight_line": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"translate_tabs_to_spaces": true,
"show_full_path": true, (macs)
"ignored_packages": [ "Vintage" ],
"word_wrap": false
# Simple hybrid crypto class using RSA for public key encryption and AES with CBC
# for bulk data encryption/decryption.
#
# RSA is used to encrypt the AES primitives which are used to encrypt the plaintext.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class RSA_AES_CBC
# If only encryption is required the private key parameter can be omitted.
#
We can't make this file beautiful and searchable because it's too large.
'00501','Holtsville','NY','America/New_York'
'00544','Holtsville','NY','America/New_York'
'01001','Agawam','MA','America/New_York'
'01002','Amherst','MA','America/New_York'
'01003','Amherst','MA','America/New_York'
'01004','Amherst','MA','America/New_York'
'01005','Barre','MA','America/New_York'
'01007','Belchertown','MA','America/New_York'
'01008','Blandford','MA','America/New_York'
@jkgraham
jkgraham / invoice.rb
Last active August 29, 2015 14:06
Refactor problem
# Introduced these two classes to the students and asked them to refactor/improve the `calculate_balance` method.
# We initially suggested maybe breaking up the method in to smaller ones.
class Invoice < ActiveRecord::Base
belongs_to :account
def calculate_balance
if display_ids.present?
items = account.items.visible.where("id IN (#{display_ids})").oldest_first
else
@jkgraham
jkgraham / crossfade.html
Created October 22, 2012 16:48
Simple jQuery image crossfade
<script src="/js/crossfade.js" type="text/javascript"></script>
<style type="text/css">
#home_slides { position: relative; width: 960px; height: 350px;}
#home_slides img { position: absolute; z-index: 1; display: none; }
#home_slides img.active { display: block; z-index: 3; }
</style>
<div id="home_slides">
<img src="/slides/slide-01.jpg" class="active">