Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Leishman leishman

View GitHub Profile
View boggle.rb
# require 'pry'
# You should re-use and modify your old BoggleBoard class
# to support the new requirements
class Cell
attr_accessor :letter, :index, :row, :column, :neighbors, :neighbor_letters, :used
def initialize(letter, index)
@letter = letter
@index = index
View sample_hash
Balance {"current_user"=>{"id"=>"5281ce07ab5a5c4ace00003d", "email"=>"leishman3@outlook.com", "name"=>"leishman3@outlook.com"}, "balance"=>{"amount"=>"0.00150165", "currency"=>"BTC"}, "transactions"=>[{"transaction"=>{"id"=>"52e979e255d8f26ad40000ba", "created_at"=>"2014-01-29T14:00:02-08:00", "hsh"=>nil, "amount"=>{"amount"=>"0.00130641", "currency"=>"BTC"}, "request"=>false, "status"=>"complete", "sender"=>{"id"=>"51c3b06779a2cc9bb3000021", "email"=>"leishman3@gmail.com", "name"=>"Alexander"}, "recipient"=>{"id"=>"", "email"=>"", "name"=>"New User"}, "recipient_address"=>"1DdUcZco2BV7xT1Rxcgp4oZ8Yp71EVKddh", "notes"=>"Voluptatem dicta quis non omnis est.", "idem"=>""}}, {"transaction"=>{"id"=>"52e979686f397ea9e700016e", "created_at"=>"2014-01-29T13:58:00-08:00", "hsh"=>nil, "amount"=>{"amount"=>"-0.00377100", "currency"=>"BTC"}, "request"=>false, "status"=>"complete", "sender"=>{"id"=>"5281ce07ab5a5c4ace00003d", "email"=>"leishman3@outlook.com", "name"=>"leishman3@outlook.com"}, "recipient"=>{"id"=>"51c3b06
View kraken_http_header
API-Key = API key
API-Sign = Message signature using HMAC-SHA512 of (URI path + SHA256(nonce + POST data)) and base64 decoded secret API key
View kraken_hmac_signature.rb
require 'httparty'
require 'hashie'
require 'Base64'
require 'addressable/uri'
def post_private(method, opts={}) # Example: post_private('Balance') #=> returns balance info from Kraken, opts not necessary
opts['nonce'] = nonce
post_data = encode_options(opts)
headers = {
@leishman
leishman / pinger.css
Last active Aug 29, 2015
CSS for a sonar-like pinger
View pinger.css
/* Create as many divs as you would like in your pinger */
/*Give each of them this class*/
.propagating-circle {
position: absolute;
top: 200px;
left: 200px;
border-radius: 50%;
border: 1px solid black;
}
@leishman
leishman / pinger.html
Last active Aug 29, 2015
HTML for a sonar-like pinger
View pinger.html
<div class="propagating-circle ping"></div>
<div class="propagating-circle ping delay-p5s"></div>
<div class="propagating-circle ping delay-1s"></div>
<div class="propagating-circle ping delay-1p5s"></div>
<div class="propagating-circle ping delay-2s"></div>
@leishman
leishman / 0.2.1-boggle_class_from_methods.rb
Last active Dec 27, 2015 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
View 0.2.1-boggle_class_from_methods.rb
## NOTE: THERE IS AN ERROR AND THE SAME GIST IS BEING USED FOR BOGGLE AND PEZ. NOT SURE WHY. HERE IS MY PEZ CLASS:
class Pez
def initialize(pez)
@pez = pez
end
def get_pez
@pez.pop
@leishman
leishman / jquery_example.html
Created Dec 26, 2013 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0
View jquery_example.html
<!DOCTYPE html>
<html>
<head>
<title>DOM manipulation with jQuery</title>
<!-- Add a link to jQuery CDN here script here -->
<script type="text/javascript" src="jquery_example.js"></script>
</head>
<body>
View favorite_ruby_methods_1.rb
# Arrays
# Array#reverse_each
# Just like Array#each, but reversed.
# This saves having to reverse an array if trying to iterate from the end
a = [1, 2, 3, 4]
str = ""
a.reverse_each{ |n| str += n.to_s } # str => "4321"
View keybase.md

Keybase proof

I hereby claim:

  • I am leishman on github.
  • I am leishman (https://keybase.io/leishman) on keybase.
  • I have a public key whose fingerprint is D7B0 60F4 DE39 077C F7BB 6D90 9B83 C27E C257 736E

To claim this, I am signing this object:

You can’t perform that action at this time.