This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json.array!(@listings) do |listing| | |
json.extract! listing, :id, :address, :listing_type, :title, :description, :price, :neighborhood_id, :host_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hello | |
def call(env) | |
[200, {'Content-Type' => 'text/html'}, ["Hello Rack!"]] | |
end | |
end | |
run Hello.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # 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 |
NewerOlder