- frameworks causing increase in time browser spends "scripting" (running JS) to handle simple button clicks
- web workers are a separate thread that can handle non-DOM tasks. Only limitation is that it cannot touch DOM
- Example: Run all of react in web worker, only run React.render() in main thread
- Two demo apps with many DOM updates, 1 using web workers has better FPS
- JSON.stringify() fastest way to send data between main thread and web worker
- Challenge: Running e.preventDefault(). The
e
object does not exist in the web worker
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 'httparty' | |
id = nil | |
while true | |
url = "http://www.letsrevolutionizetesting.com/challenge.json" | |
url += "?id=#{id}" if id | |
resp = HTTParty.get(url) | |
puts resp | |
id = resp['follow'].split('id=').last | |
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
DEBUG (00:56:31): Hook :run_all_end executed for Guard::RSpec | |
DEBUG (00:56:31): Hook :run_all_begin executed for Guard::Spork | |
DEBUG (00:56:31): Start interactor | |
DEBUG (00:56:53): Stop interactor | |
DEBUG (00:56:53): Start interactor | |
DEBUG (00:57:09): Stop interactor | |
DEBUG (00:57:09): Trying to run Guard::RSpec#run_on_modifications with ["spec/views/queries/new.html.haml_spec.rb", "s | |
pec/requests/queries_spec.rb"] | |
DEBUG (00:57:09): Hook :run_on_changes_begin executed for Guard::RSpec |
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
cat: /home/jon/.zsh/env/gem-path-prepends: No such file or directory | |
cat: /home/jon/.zsh/env/rbenv-path-prepend: No such file or directory | |
cat: /home/jon/.zsh/env/rvm-path-prepend: No such file or directory | |
cat: /home/jon/.zsh/env/gem-path-prepends: No such file or directory | |
cat: /home/jon/.zsh/env/rbenv-path-prepend: No such file or directory | |
cat: /home/jon/.zsh/env/rvm-path-prepend: No such file or directory | |
cat: /home/jon/.sh/gem-path-prepends: No such file or directory | |
cat: /home/jon/.sh/,rbenvi: No such file or directory | |
cat: /home/jon/.sh/rbenv-init: No such file or directory | |
cat: /home/jon/.sh/rbenv-path-prepend: No such file or directory |
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 FromWithQuery < Treetop::Runtime::SyntaxNode | |
def content | |
arr = [ self.elements[0].text_value.strip, | |
self.elements[1].text_value.split(",").map do |v| | |
v.strip | |
end ] | |
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 'spec_helper' | |
describe QueryParser do | |
it "doesn't implode from simple SQL queries" do | |
foo = [] | |
foo.push QueryParser.parse "SELECT user.name == 'bob' FROM users".downcase | |
foo.push QueryParser.parse "SELECT * FROM users WHERE user.name == 'bob'".downcase | |
foo.push QueryParser.parse 'select * from foo order by DESC'.downcase | |
foo.push QueryParser.parse "select name,email FROM users".downcase | |
foo.push QueryParser.parse "select * FROM joo".downcase | |
foo.push QueryParser.parse "select * FROM name == 'foo'".downcase |
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
Problem: In the matrix (below) 4 diagonal consecutive numbers are 26 63 78 14 and their product equals 1788696. | |
What is the greatest product of four adjacent numbers in any direction (up, down, left, right, or diagonally) in the 20x20 grid? | |
###Problem 11 | |
MATRIX = [ | |
%w(08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08), | |
%w(49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00), | |
%w(81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65), | |
%w(52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91), |
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 < ActiveRecord::Base | |
attr_accessible :category, :name, :price, :generic_product | |
attr_accessor :generic_product | |
validates_presence_of :name, if: :generic_product? | |
validates_presence_of :price, :category, unless: :generic_product? | |
private | |
def generic_product? | |
if generic_product == "1" | |
true | |
else |
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 'mathn' | |
class Chain | |
attr_accessor :last, :sum, :length | |
def initialize | |
@last = @sum = @length = 0 | |
end | |
def clean? | |
0 == @sum % @last |
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 'mathn' | |
class Chain | |
attr_accessor :last, :sum, :length | |
def initialize | |
@last = 0 | |
@sum = 0 | |
@length = 0 | |
end | |
def clean? | |
0 == @sum % @last |
NewerOlder