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
#!/bin/bash -xe | |
readonly TARGET_ARCH=aarch64-unknown-linux-gnu | |
readonly SOURCE_PATH="./target/$TARGET_ARCH/release/hello-world" | |
readonly TARGET_PATH=/home/fdelacruz/workspace/cross_build | |
# readonly PI_IP=192.168.1.x | |
readonly TARGET_HOST=fdelacruz@$PI_IP | |
readonly PORT=2202 | |
cargo install -f cross |
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
xcode-select --install | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew update | |
brew cask install iterm2 | |
# update iterm2 settings -> solarized presets | |
brew install git | |
brew cask install spectacle | |
brew cask install alfred | |
# set CMD+space to launch alfred | |
brew cask install firefox |
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 proc_test | |
proc = Proc.new { return } | |
proc.call | |
puts "Hello world" | |
end | |
proc_test # calling proc_test prints nothing |
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 lambda_test | |
lam = lambda { return } | |
lam.call | |
puts "Hello world" | |
end | |
lambda_test # calling lambda_test prints 'Hello World' |
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
proc = Proc.new { |x| puts x } # creates a proc that takes 1 argument | |
proc.call(2) # prints out 2 | |
proc.call # returns nil | |
proc.call(1,2,3) # prints out 1 and forgets about the extra arguments |
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
lam = lambda { |x| puts x } # creates a lambda that takes 1 argument | |
lam.call(2) # prints out 2 | |
lam.call # ArgumentError: wrong number of arguments (0 for 1) | |
lam.call(1,2,3) # ArgumentError: wrong number of arguments (3 for 1) |
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
lambda { puts "Hello!" } | |
#Is just about the same as | |
Proc.new { puts "Hello!" } |
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
cube = Proc.new { |x| x ** 3 } | |
[1, 2, 3].collect!(&cube) #=>[ 1, 8, 27] | |
[4, 5, 6].map!(&cube) #=>[64, 125, 216] |
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
array = [1, 2, 3, 4] | |
array.collect! do |n| | |
n ** 2 | |
end | |
puts array.inspect # => [1, 4, 9, 16] |
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 Gear | |
attr_reader :chainring, :cog, :rim, :tire | |
def initialize(chainring, cog, rim, tire) | |
@chainring = chainring | |
@cog = cog | |
@rim = rim | |
@tire = tire | |
end | |
def ratio |
NewerOlder