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
When fighting the devil and he does the move where he stretches his | |
neck up and then comes slithering in from the side like a snake, he | |
seems to be able to hit you while he's retracting back. But only when | |
he comes in from the right. | |
This is me doing what I think is the correct thing to avoid his attack | |
when he comes in from the left: | |
https://gfycat.com/closedlateamazondolphin | |
This is me doing the same thing when he comes in from the right: |
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 paths(n, path=[], result=[]) | |
if n == 0 | |
result << path | |
elsif n > 0 | |
[2, 3, 7].each {|score| paths(n - score, path + [score], result)} | |
end | |
result | |
end | |
puts paths(1).to_s |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" | |
elementFormDefault="qualified" vc:minVersion="1.0"> | |
<xs:annotation> | |
<xs:documentation> | |
Google Product Review Feeds allow content providers to | |
provide product reviews to Google Shopping. | |
An XML file can be validated with this schema by running: | |
xmllint --schema product_reviews.xsd --noout file.xml |
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 find_100s(digits, i=0) | |
if i == digits.length - 1 | |
eval(digits) == 100 ? [digits] : [] | |
else | |
[find_100s(digits[0..i] + "+" + digits[i+1..-1], i+2), find_100s(digits[0..i] + "-" + digits[i+1..-1], i+2), find_100s(digits, i+1)] | |
end | |
end | |
puts find_100s("123456789") |
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
# Elasticsearch version: 1.3.4 | |
curl -XDELETE localhost:9200/test > /dev/null 2>&1 | |
curl -XPUT localhost:9200/test/test/1 -d '{ | |
"name": "Finn", | |
"age": null | |
}' > /dev/null 2>&1 | |
curl -XPUT localhost:9200/test/test/2 -d '{ |
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
Failures: | |
1) Api::V1::AuthorsController index returns a list of authors by website ids | |
Failure/Error: authors.should have(1).author | |
expected 1 author, got 0 | |
# ./spec/controllers/api/v1/authors_controller_spec.rb:39:in `block (3 levels) in <top (required)>' | |
2) Api::V1::ProductsController types returns all of the product types available | |
Failure/Error: get :types | |
JSON::Schema::ValidationError: |
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
# To replace tvi's need dropdown with the price dropdown, in categories/televisions/configatron.rb, replace this: | |
configatron.televisions.filters[:need] = { | |
resource: 'articles#show', | |
prompt: 'Find the perfect product for...', | |
options: [ | |
{ name: 'Budget Buyers', query: { id: 'Budget-Buyers' }, url: '/buying-guides/budget-buyers' }, | |
{ name: 'Sports Fans', query: { id: 'Sports-Fans' }, url: '/buying-guides/sports-fans' }, | |
{ name: 'Movie Nights', query: { id: 'Movie-Nights' }, url: '/buying-guides/movie-nights' }, | |
{ name: 'Perfect Picture', query: { id: 'Perfect-Picture' }, url: '/buying-guides/perfect-picture' }, |
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
### Keybase proof | |
I hereby claim: | |
* I am lukebergen on github. | |
* I am lukebergen (https://keybase.io/lukebergen) on keybase. | |
* I have a public key whose fingerprint is CA20 CB32 13AD B8ED 3A2A 5B28 4573 8E8C EDE6 2164 | |
To claim this, I am signing this object: |
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 Product | |
before_save :early_before | |
around_save :around | |
before_save :late_before | |
def early_before | |
puts "early before" | |
end | |
def around |
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
namespace :data_migrations do | |
desc "backport awarded_times field for existing products" | |
task awarded_times_backport: :environment do | |
product_ids = Award.all.map(&:product_ids).flatten.uniq | |
pb = ProgressBar.new(product_ids.count) | |
product_ids.each do |id| | |
pb.increment! | |
product = Product.where(id: id).first | |
if product |