| Method | Uses Default Accessor | Validations | Callbacks | Touches updated_at | Readonly check |
|---|---|---|---|---|---|
| update | ✅ | ✅ | ✅ | ✅ | ✅ |
| update_attributes | ✅ | ✅ | ✅ | ✅ | |
| update_columns | ✅ | ||||
| User::update | ✅ | ✅ | ✅ | ✅ | ✅ |
| User::update_all |
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
| lookup = {'N' : (1,0), 'S' : (-1,0), 'W' : (0,-1), 'E' : (0,1)} | |
| def tuple_add(a, b): | |
| return (a[0] + b[0], a[1] + b[1]) | |
| def solve(data): | |
| pos = (0,0) | |
| solution = 0 | |
| vertices = set([pos]) | |
| fences = set() |
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
| 3388 | Why You Should Do A Tiny Product First | |
| | http://unicornfree.com/2013/why-you-should-do-a-tiny-product-first | |
| 3494 | Startup Escape Plan: How to free up time, energy & money to build your future | |
| | http://unicornfree.com/2014/startup-escape-plan-free-up-time-energy-money-to-invest | |
| 3603 | 5 Years of SaaS Growth: Every Month, Exact Numbers | |
| | http://unicornfree.com/2013/5-years-of-saas-growth-every-month-exact-numbers | |
| 3623 | Help! My SaaS isn't growing! +60% revenue, 1 year later… |
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
| 6053 text files. | |
| 5906 unique files. | |
| 639 files ignored. | |
| http://cloc.sourceforge.net v 1.64 T=26.98 s (201.5 files/s, 49091.5 lines/s) | |
| --------------------------------------------------------------------------------------- | |
| Language files blank comment code | |
| --------------------------------------------------------------------------------------- | |
| C 848 58254 31733 404921 | |
| Ruby 3454 44865 14319 367771 |
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
| # Solution by semi225599 https://www.reddit.com/r/adventofcode/comments/3y1s7f/day_24_solutions/cy9sqq2 | |
| from functools import reduce | |
| from itertools import combinations | |
| from operator import mul | |
| wts = [int(x) for x in open("input.txt").read().split('\n')] | |
| def day24(num_groups): | |
| group_size = sum(wts) // num_groups |
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
| require 'pp' | |
| class Array | |
| def perms | |
| return to_enum(:perms) unless block_given? | |
| if size <= 1 | |
| yield self | |
| else |
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
| ds = open("input.txt"). | |
| map { |line| c, d = line.strip.split(" = "); cs = c.split(" to "); [[cs, d.to_i], [cs.reverse, d.to_i]] }. | |
| flatten(1). | |
| to_h | |
| cs = ds.keys.flatten.uniq | |
| tours = cs.permutation(cs.size). | |
| map { |perm| perm.each_cons(2).map{|pair| ds[pair] }.reduce(:+) } |
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
| total = 0 | |
| evalled = 0 | |
| with open("input.txt") as f: | |
| for line in f.readlines(): | |
| line = line.strip() | |
| total += len(line) | |
| evalled += len(eval(line)) | |
| print(total - evalled) |
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
| require 'pry' | |
| class Circuit | |
| TRANSFORMS = { | |
| "LSHIFT" => "<<", | |
| "RSHIFT" => ">>", | |
| "NOT" => "~", | |
| "AND" => "&", | |
| "OR" => "|", |
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
| m = Array.new(1000) { |a| Array.new(1000, 0) } | |
| transformations = { | |
| "toggle" => proc { |input| input+2 }, | |
| "turn on" => proc { |input| input+1 }, | |
| "turn off" => proc { |input| [0, input-1].max }, | |
| } | |
| open("advent6.txt") do |f| | |
| f.each_line do |line| |