Skip to content

Instantly share code, notes, and snippets.

View TimothyClayton's full-sized avatar

Timothy Clayton TimothyClayton

View GitHub Profile
@TimothyClayton
TimothyClayton / client.rb
Last active August 10, 2023 00:21
Coinbase Advanced Trade v3 REST API Ruby Client
require "uri"
require "json"
require "net/http"
class Client
API_KEY = ENV['API_KEY']
API_SECRET = ENV['API_SECRET']
BASE_URL = 'https://api.coinbase.com'
BASE_PATH = '/api/v3/brokerage'
PRODUCT_ID = BotSettings::PRODUCT_ID
@TimothyClayton
TimothyClayton / .env.sample
Last active November 2, 2017 16:58
Braveno Exchange API Client
API_KEY='<Your API Key>'
API_SECRET='<Your API Secret>'
HOST='https://api.sandbox.braveno.com'

curl $(docker-machine ip default):3000

When in Tanker

List containers: sudo docker ps

Shell access to running container sudo docker exec -it <container name> bash

Access psql

@TimothyClayton
TimothyClayton / decider.rb
Created April 10, 2017 19:46
RSpec easy loop testing
# frozen_string_literal: true
class Decider
def self.undecided
loop do
break if decision?
end
end
def self.decision?
# code yielding true or false
@TimothyClayton
TimothyClayton / presence_exp.rb
Last active September 26, 2016 19:39
Set default value when blank values are potentially returned
# The immediate tendency is to go with a ternary, a la:
hash[:key].present? ? hash[:key] : 'default'
# To save a little on ABC complexity, I like `#presence`:
```
>> h = { a: "I'm here" }
>> h[:a].presence || 'default'
"I'm here"
@TimothyClayton
TimothyClayton / 1_vert_center_haml_bstrap3.png
Last active September 26, 2016 19:33
Easy vertical centering haml/bootstrap3
1_vert_center_haml_bstrap3.png
@TimothyClayton
TimothyClayton / 1_expand_collapse.haml
Last active August 29, 2015 14:16
Easy expand/collapse
#expand-collapse-all
= image_tag('expand_all.png', id: 'expand-all', onclick: 'showAll()')
= image_tag('collapse_all.png', id: 'collapse-all', onclick: 'hideAll()')
.things-to-hide-or-show