Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View trevorturk's full-sized avatar

Trevor Turk trevorturk

  • Chicago
View GitHub Profile
@trevorturk
trevorturk / 1.md
Last active September 11, 2023 20:29
Converting from a hash-of-arrays into an array-of-hashes

Most weather data sources give you an array of hashes (representing hours or days) with data points like so:

[
  {
    temperature: 73,
    windSpeed: 10,
  },
  {
 temperature: 70,
@trevorturk
trevorturk / main.rb
Created February 10, 2022 18:31 — forked from amirrajan/main.rb
DragonRuby Game Toolkit - Shadows (https://amirrajan.itch.io/shadows)
class Game
attr_gtk
def tick
defaults
input
calc
render
end
@trevorturk
trevorturk / hello_world.rb
Created January 12, 2017 16:34
Single page Rails 5 app
# gem install bundler
# ruby hello_world.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rails', '~> 5.0'
end

Keybase proof

I hereby claim:

  • I am trevorturk on github.
  • I am trevorturk (https://keybase.io/trevorturk) on keybase.
  • I have a public key whose fingerprint is BA9B A8C7 03A5 30E5 6B72 D928 E0F5 751D 09A6 0511

To claim this, I am signing this object:

@trevorturk
trevorturk / gist:5516046
Last active December 16, 2015 23:49
Insert an additional, separate set of fixtures from db/seeds
desc "Insert an additional, separate set of fixtures from db/seeds"
task :seed_fixtures => :environment do
require 'active_record/fixtures'
files = "#{Rails.root}/db/seeds/*.yml"
connection = ActiveRecord::Base.connection
fixtures = Dir[files].collect do |file|
extname = File.extname(file)
name = File.basename(file).chomp(extname)
@trevorturk
trevorturk / gists.rb
Created February 14, 2013 18:48
Delete all private gists
# gem install httparty
# ruby gists.rb
require 'httparty'
class Gists
include HTTParty
@username = 'x'
@password = 'x'
@trevorturk
trevorturk / import_attachment_basecamp.rb
Created June 25, 2012 14:50 — forked from shingara/import_attachment_basecamp.rb
Script to download all attachments from a basecamp project
require 'faraday'
require 'faraday_middleware'
url_project = 'https://ciblonet.basecamphq.com'
project_id = 3684800
user_name = 'shingara'
password = 'xxxx'
class Attachment
@trevorturk
trevorturk / current.rb
Created May 7, 2012 20:27 — forked from scottweisman/current.rb
Using current_kase method in views
# concerns#current
module Current
extend ActiveSupport::Concern
...
def current_kase
@current_kase ||= Kase.find_by_id(params[:kase_id])
end
# To include methods in views
@trevorturk
trevorturk / emoji.txt
Created April 3, 2012 18:47 — forked from stephencelis/emoji.txt
Emoji not on the iOS Keyboard
2139 ℹ INFORMATION SOURCE
23EB ⏫ BLACK UP-POINTING DOUBLE TRIANGLE
23EC ⏬ BLACK DOWN-POINTING DOUBLE TRIANGLE
23F0 ⏰ ALARM CLOCK
23F3 ⏳ HOURGLASS WITH FLOWING SAND
26C5 ⛅ SUN BEHIND CLOUD
26D4 ⛔ NO ENTRY
2705 ✅ WHITE HEAVY CHECK MARK
2753 ❓ BLACK QUESTION MARK ORNAMENT
2757 ❗ HEAVY EXCLAMATION MARK SYMBOL
@trevorturk
trevorturk / gist:1756760
Created February 7, 2012 02:37
Bare minimum html5 template
<!DOCTYPE html>
<html>
<head>
<title>title</title>
</head>
<body>
<p>body</p>
</body>
</html>