I hereby claim:
- I am okeeffe on github.
- I am okeeffe (https://keybase.io/okeeffe) on keybase.
- I have a public key ASCzlmnpy62Zbbwzjn6TqIIfBPH-vzTkG2W7AFIS5r06Ago
To claim this, I am signing this object:
/* | |
SQL Query to find the pairs of employees where one is younger than the other. | |
To test, try it here: http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all | |
*/ | |
SELECT e1.FirstName AS Younger, e2.FirstName AS Older | |
FROM Employees AS e1 | |
JOIN Employees AS e2 ON e1.BirthDate > e2.BirthDate; |
/* | |
SQL Query to find the CustomerIDs of all the customers who have the most orders. | |
Could be 1 or more. | |
To test, try it here: http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all | |
*/ | |
SELECT CustomerID FROM Orders | |
GROUP BY CustomerID | |
HAVING COUNT(CustomerID) = ( |
if __name__ == '__main__': | |
"""Print the coordinates of the 3D cuboid (after recieving dimensions) that do not exceed the 4th input param. | |
Sample input: | |
1 | |
1 | |
1 | |
2 | |
Sample output: | |
[[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]]""" | |
if __name__ == '__main__': | |
"""Code to work on a list as instructed by stdin. | |
Sample input (first number is # of instructions to follow): | |
12 | |
insert 0 5 | |
insert 1 10 | |
insert 0 6 | |
remove 6 |
I hereby claim:
To claim this, I am signing this object:
# CONSTANTS | |
ROMAN_TO_VAL = { | |
I: 1, | |
V: 5, | |
X: 10, | |
L: 50, | |
C: 100, | |
D: 500, | |
M: 1000, | |
IV: 4, |
class Regexp | |
def self.split_num_into_subranges(rounded_min, num) | |
# 256 -> 200..249 & 250..256 | |
range_arr = [] | |
num_arr = num.to_s.chars | |
i = num_arr.length - 1 | |
# > 0 to avoid changing the first digit | |
while i > 0 | |
# Save the original number (max of the subrange) |
# TO RUN: download, cd into the dir and: ruby lcd.rb 12 (for default size of 2) | |
# or ruby lcd.rb -s 4 9346433 | |
# CONSTANTS | |
MIDDLE_SEGMENT_IDX = 1 | |
DEFAULT_SIZE = 2 | |
DEFAULT_NUM = '0'.freeze | |
ZERO = [' - ', '| |', ' ', '| |', ' - '].freeze |
A Pen by Richard Bray on CodePen.
So awesome I had to save it as a gist for future reference. Nice one Richard!