Shortcut | Description |
---|---|
⌘ K ⌘ S | Keyboard shortcuts |
⇧ ⌥ ↓ | Copy line down |
⌥ W | Switch window |
⇧ ⌘ F | Focus Search |
⇧ ⌘ E | Focus Explorer |
⌥ T | Focus terminal |
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
WebMock.allow_net_connect! | |
WebMock.after_request do |request_signature, response| | |
stubbing_instructions = | |
WebMock::RequestSignatureSnippet | |
.new(request_signature) | |
.stubbing_instructions | |
puts '===== outgoing request =======================' | |
puts stubbing_instructions | |
puts | |
puts "response status: #{response.status.inspect}" |
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 MyList do | |
def map([], _func), do: [] | |
def map([ head | tail ], func), do: [ func.(head) | map(tail, func) ] | |
end | |
MyList.map [1,2,3,4], fn (n) -> n*n end | |
MyList.map [1,2,3,4], &(&1 * &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
defmodule Factorial do | |
def of(0), do: 1 | |
def of(n), do: n * of(n-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
fizz_buzz = fn | |
(0,0,_) -> "FizzBuzz" | |
(0,_,_) -> "Fizz" | |
(_,0,_) -> "Buzz" | |
(_,_,a) -> a | |
end | |
IO.puts fizz_buzz.(0,0,"foo") | |
IO.puts fizz_buzz.(0,"foo","bar") | |
IO.puts fizz_buzz.("foo",0,"bar") | |
IO.puts fizz_buzz.("foo","bar","Atlas") |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
Ctrl-Shift-E: will split the view vertically. | |
Ctrl-Shift-O: will split the view horizontally. | |
Ctrl-Shift-(arrow key): move "panel" | |
Alt-(arrow key): move the focus |
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 | |
### BEGIN INIT INFO | |
# Provides: APPLICATION | |
# Required-Start: $all | |
# Required-Stop: $network $local_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start the APPLICATION unicorns at boot | |
# Description: Enable APPLICATION at boot time. | |
### END INIT INFO |
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
# This prevents capistrano from hanging when executing long tasks | |
# /etc/ssh/sshd_config | |
TCPKeepAlive yes | |
ClientAliveInterval 15 | |
ClientAliveCountMax 5 | |
# Restart sshd |
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
# If you post to a Ruby on Rails REST API endpoint, then you'll get an | |
# InvalidAuthenticityToken exception unless you set a different | |
# content type in the request headers, since any post from a form must | |
# contain an authenticity token. | |
# | |
# This example shows you how to post to a rails endpoint. | |
require 'json' |
NewerOlder