This file contains hidden or 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
public Car(double mpg) | |
{ | |
milesDriven = 0; // initialize value | |
gasInTank = 0; // initialize value | |
milesPerGallon = mpg; // initialize value | |
} |
This file contains hidden or 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
public class Car | |
{ | |
private double milesDriven; | |
private double gasInTank; | |
public void drive(double distance) | |
{ | |
milesDriven = milesDriven + distance; | |
} | |
public void addGas(double amount) |
This file contains hidden or 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
public class Car | |
{ | |
private double milesDriven; | |
private double gasInTank; | |
public void drive(double distance) | |
public void addGas(double amount) | |
// Additional methods fill in below | |
} |
This file contains hidden or 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
# controllers/api/venues_controller.rb | |
module API | |
class VenuesController < ApplicationController | |
respond_to :json | |
def show | |
@venue = Venue.find(params[:id]) | |
render json: @venue | |
#respond_to do |format| | |
# format.json { render :json => venue } |
This file contains hidden or 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
module API | |
class VenuesController < ApplicationController | |
respond_to :json | |
def show | |
@venue = Venue.find(params[:id]) | |
render json: @venue | |
#respond_to do |format| | |
# format.json { render :json => venue } | |
#end |
This file contains hidden or 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
# routes.rb | |
... | |
#API Routes | |
namespace :api, path: '/', constraints: { subdomain: 'api' } do | |
resources :venues, only: [ :index, :show ] | |
end | |
# /controllers/api/venues_controller.rb |
This file contains hidden or 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
curl https://saucelabs.com/rest/v1/[username]/js-tests \ | |
-X POST \ | |
-u [username]:[username] \ | |
-H 'Content-Type: application/json' \ | |
--data '{ | |
"platforms": [["Windows 8", "internet explorer", "10"]], | |
"url": "https://qunit.herokuapp.com/test/test.html?coverage=true", | |
"framework": "qunit"}' |
This file contains hidden or 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
$(document).ready(function () { | |
var audioPlayer = new AudioPlayer ({ | |
el: document.getElementById("audio-player"), | |
songs: [ | |
{ | |
name: "Language Is Alive (Mass Effect Mashup)", | |
duration: "6:38", | |
srcs: [ | |
{ | |
src: "Language Is Alive (Mass Effect Mashup).mp3", |
This file contains hidden or 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
t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts | |
t.string :unlock_token # Only if unlock strategy is :email or :both | |
t.datetime :locked_at |
This file contains hidden or 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
def self.search(query) | |
__elasticsearch__.search( | |
{ | |
query: { | |
multi_match: { | |
query: query, | |
fields: ['name^5', 'properties^3', 'tips', 'venue_subcategory'], | |
} | |
} | |
} |