This file contains 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
[json response] | |
data: { | |
id: 1, | |
type: "users", | |
attributes: { name: "John" }, | |
relationships: { | |
notes: [ | |
{ id: 1, type: "notes" }, | |
{ id: 2, type: "notes" } | |
] |
This file contains 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
> gcd(nth_fibonacci(32), nth_fibonacci(33)) | |
=> 1 |
This file contains 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 gcd(x, y) | |
loop do | |
r = x % y | |
return y if r.zero? | |
x, y = y, r | |
end | |
end |
This file contains 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
require 'benchmark' | |
require 'open-uri' | |
iterations = ARGV.first.to_i | |
S3_URL = 'http://s3.amazonaws.com/<supersecret>/images/1.original.jpg?1438008505' | |
CLOUDFRONT_URL = 'http://<supersecret>.cloudfront.net/images/1.original.jpg?1438008505' | |
Benchmark.bmbm(10) do |x| | |
x.report('cloudfront') { iterations.times{ open(CLOUDFRONT_URL) } } | |
x.report('s3') { iterations.times{ open(S3_URL) } } |
This file contains 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
set-window-option -g mode-keys vi | |
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" | |
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" | |
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" | |
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" | |
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l" |
This file contains 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 User < ActiveRecord::Base | |
has_many :notes | |
end | |
class UserSerializer < ActiveModel::Serializer | |
attributes :id, :name | |
has_many :notes | |
end | |
``` | |
``` |
This file contains 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
> ActiveRecord::Base.connection.execute("select count(*) from ( select distinct market_id from selections) as foo ").entries | |
(3717.6ms) select count(*) from ( select distinct market_id from selections) as foo |
This file contains 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
public class CameraViewActivity extends Activity implements | |
SurfaceHolder.Callback,OnLocationChangedListener,OnAzimuthChangedListener{ | |
private Camera mCamera; | |
private SurfaceHolder mSurfaceHolder; | |
private boolean isCameraviewOn = false; | |
private AugmentedPOI mPoi; | |
private double mAzimuthReal = 0; | |
private double mAzimuthTeoretical = 0; |
This file contains 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
tasks: | |
- name: remove admin account | |
user: name=admin state=absent remove=true |
This file contains 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
(...) | |
PLAY RECAP ************************************************************** | |
<IP> : ok=3 changed=0 unreachable=0 failed=0 |
NewerOlder