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
| class Dog | |
| def initialize(name, breed, age) | |
| @name = name | |
| @breed = breed | |
| @age = age | |
| end | |
| def bark | |
| "Woof!" | |
| 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
| rails new my_great_app -T -d postgresql --skip-turbolinks | |
| cd my_great_app | |
| git init | |
| git add . | |
| git commit -m "Initial commit. Rails boilerplate." | |
| #Edit Gemfile. Uncomment the reference to bcrypt and remove the reference to coffee-rails. | |
| bundle install | |
| git add . |
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
| FactoryGirl.define do | |
| factory :group do | |
| primary_number { Faker::Number.number(3) } | |
| street_name { Faker::Address.street_name } | |
| city_name { Faker::Address.city } | |
| state_abbreviation { Faker::Address.state_abbr } | |
| zipcode { Faker::Address.zip_code } | |
| end | |
| factory :user, aliases: [:candidate, :requester, :responder] do |
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
| defmodule Guesser do | |
| def guess(actual, range) do | |
| range_midpoint = midpoint(range) | |
| try_guess(range_midpoint, actual, range) | |
| end | |
| defp try_guess(range_midpoint, actual, range) do | |
| IO.puts "trying #{range_midpoint}" | |
| cond do |
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
| defmodule MyEnum do | |
| def all?([], _) do | |
| true | |
| end | |
| def all?([head | tail], funct) do | |
| if funct(head) do | |
| all?(tail, funct) | |
| else | |
| false |
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
| tax_rates = [NC: 0.075, TX: 0.08] | |
| orders = [ | |
| [id: 123, ship_to: :NC, net_amount: 100.00], | |
| [id: 124, ship_to: :OK, net_amount: 35.50], | |
| [id: 125, ship_to: :TX, net_amount: 24.00], | |
| [id: 126, ship_to: :TX, net_amount: 44.80], | |
| [id: 127, ship_to: :NC, net_amount: 25.00], | |
| [id: 128, ship_to: :MA, net_amount: 10.00], | |
| [id: 129, ship_to: :CA, net_amount: 102.00], |
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
| 0 info it worked if it ends with ok | |
| 1 verbose cli [ '/usr/bin/nodejs', | |
| 1 verbose cli '/usr/bin/npm', | |
| 1 verbose cli 'dist-tag', | |
| 1 verbose cli 'add', | |
| 1 verbose cli '[email protected]', | |
| 1 verbose cli 'test' ] | |
| 2 info using [email protected] | |
| 3 info using [email protected] | |
| 4 verbose dist-tag add test to [email protected] |
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.exports = { | |
| entry: "./app.js", | |
| output: { | |
| path: __dirname + "/dist", | |
| filename: "bundle.js" | |
| }, | |
| module: { | |
| loaders: [ | |
| { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" } | |
| ] |
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.exports = { | |
| entry: "./dev/app.js", | |
| output: { | |
| path: __dirname + "/public/js", | |
| filename: "build.js" | |
| }, | |
| module: { | |
| preLoaders: [ | |
| { test: /\.js$/, exclude: /node_modules/, loader: "eslint-loader" } | |
| ], |
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
| { | |
| "name": "nodejs-and-express-app", | |
| "version": "1.0.0", | |
| "description": "Following along with the Building Web Applications with Node.js and Express 4.0 tutorial from PluralSight.", | |
| "main": "app.js", | |
| "scripts": { | |
| "start": "webpack --progress --colors --watch -d", | |
| "build": "webpack --progress --colors -p", | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, |