Skip to content

Instantly share code, notes, and snippets.

@kyletolle
kyletolle / changeset.json
Last active August 29, 2015 14:05
changeset.json
{
"changeset": {
"metadata": {
"application": "Fulcrum iOS",
"application_build": "1823",
"application_version": "2.3.3",
"device_identifier": "4EDA094F-DCC2-40C5-B71A-9FF22B831409",
"device_manufacturer": "Apple",
"device_model": "iPhone6,1",
"platform": "iOS",
@kyletolle
kyletolle / hash_modification.rb
Created August 12, 2014 15:21
Hash Modification Example
#
# Hashes can be modified by a method they're passed in to, which would affect
# what they contain. This could be an unexpected side-effect.
# $ ruby hash-modification.rb
# Hash before modification:
# {:a=>1, :b=>2}
# Hash after modification
# {:a=>1, :b=>2, :c=>3, :d=>4}
#
original_hash = { a: 1, b: 2 }
@kyletolle
kyletolle / fulcrum_projects_example.json
Last active August 29, 2015 14:03
Fulcrum Example Projects
{
"current_page": 1,
"per_page": 20000,
"projects": [
{
"created_at": "2014-05-07T19:17:42Z",
"description": "Data collected that is in the Denver, CO area.",
"id": "3bc943c3-6477-4010-a876-85fce6fdf11",
"name": "Denver",
"updated_at": "2014-05-07T19:17:42Z"
@kyletolle
kyletolle / fulcrum_example_record.json
Created May 21, 2014 14:52
Fulcrum Example Record
{
"record": {
"altitude": null,
"assigned_to": null,
"assigned_to_id": null,
"client_created_at": "2014-04-09T12:24:36Z",
"client_updated_at": "2014-04-09T12:26:50Z",
"course": null,
"created_at": "2014-04-28T20:38:46Z",
"created_by": "Kyle Tolle",
@kyletolle
kyletolle / fulrum_form_example.json
Created May 21, 2014 14:32
Fulcrum Form Example
{
"form": {
"auto_assign": false,
"bounding_box": [
48.8518638,
2.3130969889462,
48.8772149651485,
2.3516665
],
"created_at": "2014-04-21T21:29:01Z",
@kyletolle
kyletolle / gist:9939366
Created April 2, 2014 17:51
RubyProf outline
RubyProf.start
# Code to profile...
result = RubyProf.stop
# Print a graph to an HTML file, sorted by time spend in children.
File.open('profile_output.html', 'w') do |file|
printer = RubyProf::GraphHtmlPrinter.new result
printer.print(file, sort_method: :children_time)
@kyletolle
kyletolle / photo_upload_response.json
Last active August 29, 2015 13:57
Uploading a photo to Fulcrum from Python
// This is the response from the call, reformatted for readability.
{
"photo": {
"access_key": "f37be52e-06d2-418a-916d-0e5874a0de29",
"created_at": "2014-03-10T20:54:26Z",
"created_by": "Kyle Tolle",
"created_by_id": "51efe7d6a93448fc300048d9",
"exif": {
"pixel_x_dimension": 1090,
@kyletolle
kyletolle / deep_each.rb
Last active February 19, 2019 18:55
deep_each.rb - a multidimensional each for Ruby
two_d_grid =
[
[ 1, 2, 3, 4, 5 ],
[ 6, 7, 8, 9, 10 ],
[ 11, 12, 13, 14, 15]
]
puts "Basic 2D each"
two_d_grid.each do |row|
row.each do |cell|
@kyletolle
kyletolle / alleys.geojson
Created January 24, 2014 15:19
States and Alleys
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyletolle
kyletolle / README.md
Created January 23, 2014 17:02
US States Colored by Name Length