git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
$ Person = Struct.new(:first_name, :last_name) do | |
def initialize(*args) | |
raise ArgumentError, "Incorrect arguments" unless args[0].member?(:first_name) && args[0].member?(:last_name) | |
super(*args) | |
self.freeze | |
end | |
end | |
=> Person | |
$ eryan = Person.new(first_name: "Eryan") |
$ Employee = Struct.new(:first_name, :last_name, :email, keyword_init: true) | |
=> Employee(keyword_init: true) | |
$ employee = Employee.new(first_name: "Eryan", last_name: "Cobham", email: "[email protected]") | |
=> #<struct Employee first_name="Eryan", last_name="Cobham", email="[email protected]"> | |
# output all properties of the struct, even uninitialized ones | |
$ employee.members | |
=> [:first_name, :last_name, :email] |
# Companies have Employees, and Employees have Addresses | |
$ Company = Struct.new(:name, :employees, keyword_init: true) | |
=> Company(keyword_init: true) | |
$ Employee = Struct.new(:first_name, :last_name, :address, keyword_init: true) | |
=> Employee(keyword_init: true) | |
$ Address = Struct.new(:street, :city, :state, :zip, keyword_init: true) | |
=> Address(keyword_init: true) |
$ Client = Struct.new(:first_name, :last_name, keyword_init: true) | |
=> Client(keyword_init: true) | |
$ client_1 = Client.new(first_name: "Jamal", last_name: "Windsor") | |
=> #<struct Client first_name="Jamal", last_name="Windsor"> | |
# using a getter | |
$ client_1.first_name | |
=> "Jamal" |
# Ruby 2.5 | |
# Create a struct the new way | |
$ Coordinate = Struct.new(:latitude, :longitude, keyword_init: true) | |
=> Coordinate(keyword_init: true) | |
# keyword arguments, can define any property | |
$ chicago = Coordinate.new(longitude: -87.67897) | |
=> #<struct Coordinate latitude=nil, longitude=-87.67897> |
Run rails new --help
to view all of the options you can pass to rails new
:
$ bin/rails new --help
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/eliot/.rbenv/versions/2.2.0/bin/ruby
Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.
Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.
As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.
Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.
class ChildComponent extends React.Component { | |
render() { | |
const {hello} = this.props.greetings; | |
return <h1>{hello}</h1>; | |
} | |
} | |
const ChildContainer = Relay.createContainer(ChildComponent, { | |
initialVariables: { | |
name: 'A', |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |