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 quux | |
:quux | |
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
let someArray = [1; 2; 3];; | |
let incremented = map (function x -> x + 1) someArray;; |
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 interesting | |
[1, 2, 3].map { |x| x + 1 } | |
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
```ruby | |
def bar | |
:baz | |
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
class MarkdownCreator | |
def foo_bar | |
[1, 2, 3].each do |n| | |
puts n | |
end | |
end | |
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
var x = 2; | |
var y = 2; | |
console.log(x + y); |
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
dayOptions() { | |
const { date } = this.props; | |
const month = date.getMonth(); | |
const year = date.getFullYear(); | |
const possibleDays = makeRange(1, 31); | |
const actualDays = possibleDays.filter(day => { | |
// We take an advantage of the fact that if you | |
// specify the 'invalid' date like 31st of February | |
// it'll automatically switch to the next month. | |
// So new Date(2016, 1, 90) === Apr 30th 2016 |
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 Customer < ActiveRecord::Base | |
after_create :send_welcome_email, unless: :auto_registered? | |
has_one :auto_created, dependent: :destroy | |
private | |
def send_welcome_email | |
CustomerMailer.welcome_email(self).deliver | |
end | |
def auto_registered? |
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 CustomersController < ApplicationController | |
# … | |
def create | |
@customer = Customer.new(customer_params) | |
respond_to do |format| | |
if @customer.save | |
format.html { redirect_to @customer, | |
notice: 'Customer was successfully created.' } | |
format.json { render :show, status: :created, |
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 Customer < ActiveRecord::Base | |
has_one :auto_created, dependent: :destroy | |
def self.register(params) | |
new(params).tap do |customer| | |
customer.save! | |
customer.send_welcome_email | |
end | |
end | |