Skip to content

Instantly share code, notes, and snippets.

View cromwellryan's full-sized avatar

Ryan Cromwell cromwellryan

View GitHub Profile
2.1.3 :008 > Event.pluck("measurements->>'diameter'")
(0.4ms) SELECT measurements->>'diameter' FROM "events"
=> ["2.3421"]
$> tmi http://seesparkbox.com
Your image weight:
66.17 kB
Average image weight on the web:
1.2 MB
Thanks for keeping the web fast <3
$> tmi http://apple.com
@cromwellryan
cromwellryan / containers
Last active August 29, 2015 14:10
Based on the [swipely/docker-api](https://github.com/swipely/docker-api) examples for [Docker::Container](https://github.com/swipely/docker-api#containers)
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8869019b7f19 ubuntu:latest "find / -name *" 10 hours ago lonely_babbage
f39a343c7b99 ubuntu:latest "find / -name *" 11 hours ago focused_wozniak9
12111ccc7eee ubuntu:latest "find / -name *" 11 hours ago backstabbing_archimedes
@cromwellryan
cromwellryan / _sample.rb
Last active August 29, 2015 14:10
Using the latest docker-api and boot2docker installations I'm unable to successfully receive stdout, stdo
require 'docker' #1.15
require 'json'
require './samples'
class PLogger
def debug(*msg)
p "Debug: #{msg}"
end
end
1..10 |> map &( {&1, to_string(&1)} )
  • asdf
  • asdf
@cromwellryan
cromwellryan / greed.rb
Last active August 29, 2015 14:14
@kaseybon Greed Kata Ideas for Classes/Objects
# My approach for the greed game was to take the values in a roll and sort them into seperate arrays. For example all the ones would be in an array, twos in an array, etc.. To keep these neat and tidy I will organize them into a hash.
# I could create a class called dice with two methods, roll and score:
#The roll method will randomly generate the numbers for the roll (I don't think this project included that but I'll add it anyways) and them store them into their arrays of similar numbers.
# The score method would be responsible for taking the sorted arrays and calculating the score then return the score.
class Dice
def initialize
@roll = {1 => [], 2 => [], 3 => [], 4 => [], 5 => [], 6 => []}
@points = 0
@cromwellryan
cromwellryan / circle.yml
Created March 31, 2015 03:12
how to archive a deployable tarball with circleci
deployment:
production:
branch: master
commands:
- tar --exclude=".git" --exclude="node_modules" -czvf ~/wm.tar.gz .
@cromwellryan
cromwellryan / README.md
Last active August 29, 2015 14:18
Sparkbox Hackday 2015 v1 selected projects

Sparkbox Hackday 2014-04-02

Curious how we run hackdays?

Proposal by: Rob Harr

I have been playing with some code that runs on a raspberry pi that can detect bluetooth signatures. I would love to add a fancy frontend that we can setup to run on a large display at the office.

Currently the code that I have that runs on the raspberry pi is designed in such a way that a number of raspberry pi's could be added to the system in a distributed way.

// amazing module
window.myModule = {
go: function() { return 1; }
}