Here's how to do that if the code is in github:
Summary
Just add#L[STARTING_LINE_NO]-[ENDING_LINE_NO]
to the end of the original url.
Example
https://github.com/angular/angular.js/blob/master/test/ApiSpecs.js#L6-16
Attention SPAMMERS: Don't advertise your services on my blog. If you do then you will have implicitly given me permission to disable any service you advertise via my blog by any means necessary.
#L[STARTING_LINE_NO]-[ENDING_LINE_NO]
to the end of the original url.
https://github.com/angular/angular.js/blob/master/test/ApiSpecs.js#L6-16
We are uncovering better ways of developing software by doing it and
helping others do it. Through this work we have come to value:
Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan
That is, while there is value in the items on the right,
we value the items on the left more.
Agile software development is a group of software development methods based on iterative and incremental development, where requirements and solutions evolve through collaboration between self-organizing, cross-functional teams.
1. 10 Frames
2. Each frame throw the ball 2 times *
3. 10 pins
4. Each pin is worth 1 point
# Spare
7 3 -> Frame 1: 15
5 0 -> Frame 2: 15 + 5 -> 20
# Strike
10 0 -> Frame 1: 18
5 3 -> Frame 2: 18 + 8 -> 26
class BowlingGame
NUMBER_OF_FRAMES = 10
# BowlingGame.new(Strike, Spare, Frame)
def initialize(*policies)
@policies = policies # Each Frame type has different policies used for scoring
@rolls = [] # Array of rolls (number of pins knocked down)
end
# Add number of pins knocked down to @rolls array
def roll(pins_knocked_down)
@rolls << pins_knocked_down
end
# Sum each frame's score for total
# See: http://lexsheehan.blogspot.com/search?q=functional+programming
def score
frames.reduce(0) { |sum, frame| sum + frame.score }
end
# A frame consists of two rolls, unless first roll is a Strike (special rules for last frame)
def frames
roll_index = 0
frames = []
NUMBER_OF_FRAMES.times do |i|
frames << frame(roll_index)
# Polymorphism: Frames could be a Strike or a Spare, both of which have a number_of_rolls method
# Spare has 2 rolls and Strike has 1 roll
is_last_frame = i.eql?(NUMBER_OF_FRAMES - 1) # Last frame gets bonus roll(s)
roll_index += frames.last.number_of_rolls(is_last_frame)
end
frames
end
# Use strategy pattern to select appropriate Frame type (regular Frame, Spare or Strike)
# See: http://en.wikipedia.org/wiki/Strategy_pattern
def frame(roll_index)
@policies.each do |policy|
# Select frame based on policy in found? methods
return policy.new(@rolls, roll_index) if policy.found?(@rolls, roll_index)
end
end
end
class Frame
def initialize(rolls, roll_index)
@rolls = rolls # Array of rolls, where each equates to number of pins knocked down in that roll
@roll_index = roll_index # The first roll index in this frame
end
def score
@rolls[@roll_index] + @rolls[@roll_index + 1] # Sum of both rolls in frame
end
def self.found?(rolls, roll_index)
true # If neither Spare or Strike then this is a regular Frame
end
def number_of_rolls(is_last_frame)
2 # Default to 2 rolls (regardless of whether it's last frame)
end
end
class Strike < Frame
# In the frame where strike is rolled, add 10 to number of pins knocked down in next two rolls
def score
10 + @rolls[@roll_index + 1] + @rolls[@roll_index + 2]
end
# Strike strategy found when number of pins knocked down in first rolls of frame equals 10
def self.found?(rolls, roll_index)
rolls[roll_index].eql?(10)
end
# Override Frame type's number_of_rolls method
def number_of_rolls(is_last_frame)
# If the last frame starts with a strike, we get 2 bonus rolls
is_last_frame ? 3 : 1
end
end
it "scores 0 with a gutter ball game" do
20.times { game.roll 0 }
expect(game.score).to eq(0)
end
it "scores 300 with all strikes" do
12.times { game.roll 10 }
expect(game.score).to eq(300)
end
it "scores 150 with all 5's" do
21.times { game.roll 5 }
expect(game.score).to eq(150)
end
| Data Element | Storage Permitted | Protection Required | PCI DSS Req. 3.4 | |
| Cardholder Data | Primary Account Number (PAN) | Yes | Yes | Yes |
| Cardholder Name | Yes | Yes 1 | No | |
| Service Code 1 | Yes | Yes 1 | No | |
| Expiration Date 1 | Yes | Yes 1 | No | |
| Sensitive Authentication Data 2 | Full Magnetic Stripe Data 3 | No | N/A | N/A |
| CAV2/CVC2/CVV2/CID | No | N/A | N/A | |
| PIN/PIN Block | No | N/A | N/A |
-Xms128m
-Xmx1024m
-XX:MaxPermSize=500m
-XX:ReservedCodeCacheSize=128m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
sudo find / -maxdepth 15 -name "idea.vmoptions" -type f 2>/dev/null)
>> User.find_each(:batch_size => 100) do |user| end
User Load (9.3ms) SELECT "users".* FROM "users" WHERE ("users"."id" >= 0) ORDER BY "users"."id" ASC LIMIT 100
User Load (5.3ms) SELECT "users".* FROM "users" WHERE ("users"."id" > 100) ORDER BY "users"."id" ASC LIMIT 100
User Load (6.2ms) SELECT "users".* FROM "users" WHERE ("users"."id" > 200) ORDER BY "users"."id" ASC LIMIT 100
User Load (4.6ms) SELECT "users".* FROM "users" WHERE ("users"."id" > 300) ORDER BY "users"."id" ASC LIMIT 100
User Load (4.0ms) SELECT "users".* FROM "users" WHERE ("users"."id" > 400) ORDER BY "users"."id" ASC LIMIT 100
User Load (4.1ms) SELECT "users".* FROM "users" WHERE ("users"."id" > 500) ORDER BY "users"."id" ASC LIMIT 100
. . .
>> User.all.each do |user| end
User Load (416.9ms) SELECT "users".* FROM "users"
EXPLAIN (0.6ms) EXPLAIN SELECT "users".* FROM "users"
EXPLAIN for: SELECT "users".* FROM "users"
QUERY PLAN
------------------------------------------------------------------------
Seq Scan on users (cost=0.00..1253.72 rows=7372 width=2726)
(1 row)