Skip to content

Instantly share code, notes, and snippets.

View ambethia's full-sized avatar
🐼
PANDAS!

Jason L Perry ambethia

🐼
PANDAS!
View GitHub Profile
resources :books
# is short hand for:
get 'books' => 'books#index' #as => 'books'
post 'books' => 'books#create' #as => 'books'
get 'books/new' => 'books#new', :as => 'new_book'
get 'books/:id/edit' => 'books#edit', :as => 'edit_book'
get 'books/:id' => 'books#show', :as => 'book'
patch 'books/:id' => 'books#update' #as => 'book'
@ambethia
ambethia / Gemfile
Last active August 29, 2015 14:23
Rails 5 (edge) API app
source 'https://rubygems.org'
ruby '2.2.2'
gem 'rails', :github => 'rails/rails'
gem 'arel', :github => 'rails/arel'

Normal Mode

How many users are there?

SELECT COUNT(*) FROM users;

What are the 5 most expensive items?

SELECT * FROM items ORDER BY price DESC LIMIT 5;

@ambethia
ambethia / airplane.c
Last active August 29, 2015 14:20
Lets talk about gist
#include airplane.h
function main() {
int i = 0;
return 0;
};
// bah!
@ambethia
ambethia / bio.md
Last active August 29, 2015 14:20

Jason is a native Floridian who started building for the web as a teen in the mid-'90s. He's been a Rubyist for about as long as anybody, founding the Tampa Ruby Brigade in 2006 and taking great pride in being an active leader in the local tech community. After stints in academia, startups, and as a consulting freelancer, he has found great joy in mentoring and sharing the knowledge gained over his career. He's also a game development enthusiast with a love for 3D modeling and animation. Jason is a father, a skeptic, entirely too opinionated, and prefers a word count with a power of two. When the world gets heavy you can find him either building LEGO® as catharsis or harnessing his power animal-- the panda bear.

@ambethia
ambethia / gist:4d1c8fa7246c14b5c48c
Created November 25, 2014 06:48
Enable Assistive Devices for `osascript` on Mavericks and Yosemite
sudo sqlite3 /Library/Application\ Support/com.apple.TCC/tcc.db "INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','/usr/bin/osascript',1,1,1,NULL)"
# Code here...
if __FILE__ == $0
require "minitest/autorun"
class StubTest < MiniTest::Test
def test_stub
assert(true)
@ambethia
ambethia / book.rb
Last active August 29, 2015 14:06
Throttle Hack
class Book
extend Throttle
def self.sales_rank(isbn_13)
throttle(1.second) do
# Do stuff with Amazon Product API that's rate limited to 1 req/s.
end
end
end
-- Reading configuration and build instructions -- 1404859264 [Tue, 08 Jul 2014 18:41:04 -0400]
Please wait, this will take some time...
-- Workorder Summary -- 1404859266 [Tue, 08 Jul 2014 18:41:06 -0400]
Timesys Factory (Released: 20140707)
System
|----------------------------------------|
| Board Name | premierwave_xn |
| Architecture | armv5l |
| Kernel Architecture | arm |
| Kernel Version | 2.6.39 |