Skip to content

Instantly share code, notes, and snippets.

Amanda Himmelstoss ahimmelstoss

Block or report user

Report or block ahimmelstoss

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6418ca241d269cba73ec
Working with the cloud CLI:
`spark cloud login`
Positive end (shorter end) of the LED pin needs to be curcuit
Negative end (longer end) of LED pin needs to be on the resister
Negative Goes to Ground
Resister connects to the Input, and one below the Input point, connect the Cable; one end of Cable goes to the Ground (GND)
Motor:
Red positive
@ahimmelstoss
ahimmelstoss / listings_controller_spec.rb
Last active Apr 6, 2017
spec for listings controller
View listings_controller_spec.rb
require 'rails_helper'
RSpec.describe ListingsController, :type => :controller do
render_views
let(:json) { JSON.parse(response.body) }
describe "GET /listings.json" do
before do
get :index, format: :json
@ahimmelstoss
ahimmelstoss / index.json.jbuilder
Created Jul 29, 2014
jbuilder for listings index
View index.json.jbuilder
json.array!(@listings) do |listing|
json.extract! listing, :id, :address, :listing_type, :title, :description, :price, :neighborhood_id, :host_id
end
View listings_controller.rb
class ListingsController < ApplicationController
before_action :set_listing, only: [:show, :update, :destroy]
# GET /listings
def index
if listing_type = params[:listing_type]
@listings = Listing.where(listing_type: listing_type)
elsif price = params[:price]
@listings = Listing.where(price: price)
else
@ahimmelstoss
ahimmelstoss / factories.rb
Created May 14, 2014
factory girl for blog lab
View factories.rb
FactoryGirl.define do
# tags
factory :happy_tag, class: Tag do |t|
t.name "happy"
end
factory :funny_tag, class: Tag do |t|
t.name "funny"
end
factory :fluffy_tag, class: Tag do |t|
t.name "fluffy"
View rsvp-seed.rb
host_user = User.new
host_user.name = "Host User"
host_user.save
guest_user = User.create(:name => "Guest User")
not_attending_user = User.create(:name => "Not Attending User")
attending_user = User.create(:name => "Attending User")
birthday = Event.create(:name => "Birthday", :host => host_user)
holiday_party = host_user.hosted_events.create(:name => "Holiday Party")
View .bash_profile
# Configuring Our Prompt
# ======================
# This function is called in your prompt to output your active git branch.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# This function builds your prompt. It is called below
function prompt {
View config.ru
class Hello
def call(env)
[200, {'Content-Type' => 'text/html'}, ["Hello Rack!"]]
end
end
run Hello.new
View serialize.rb
RSpec.configure do |config|
# Use color in STDOUT
config.color_enabled = true
# Use color not only in STDOUT but also in pagers and files
config.tty = true
# Use the specified formatter
config.formatter = :progress # :progress, :html, :textmate
end
View roman_numerals.rb
# # Roman Numerals
# The Romans were a clever bunch. They conquered most of Europe and ruled it for hundreds of years. They invented concrete and straight roads and even bikinis. One thing they never discovered though was the number zero. This made writing and dating extensive histories of their exploits slightly more challenging, but the system of numbers they came up with is still in use today. For example the BBC uses Roman numerals to date their programmes.
# The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice these letters have lots of straight lines and are hence easy to hack into stone tablets).
# Write a function to convert from normal numbers to Roman Numerals: e.g.
# ```
# 1 => I
You can’t perform that action at this time.