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
import torch | |
import timeit | |
def compare_cpu_mps(size, dimensions = 2, iterations = 2_500): | |
a_cpu = torch.rand(size, device='cpu') | |
b_cpu = torch.rand(tuple((size for n in range(dimensions))), device='cpu') | |
a_mps = torch.rand(size, device='mps') | |
b_mps = torch.rand(tuple((size for n in range(dimensions))), device='mps') | |
print(' - cpu', timeit.timeit(lambda: a_cpu @ b_cpu, number=iterations)) |
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
options = new Backbone.Collection([{id: 1, name: "Blue"}, {id: 2, name: "Green"}]) | |
view = new SelectListView({ collection: options }) | |
view.render() |
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
Date OR DT Distance | |
2013-01-25 SAN DEN 853 | |
2013-01-25 DEN STL 770 | |
2013-01-26 STL ORD 258 | |
2013-01-28 SAN ORD 1723 | |
2013-01-28 ORD STL 258 | |
2013-01-28 STL IAH 667 | |
2013-01-28 IAH SAN 1303 | |
2013-02-01 SAN DEN 853 | |
2013-02-01 DEN BNA 1013 |
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
* [JAN25] SAN-DEN-STL, STL-ORD-SAN: 4699 for $133.20 (2.83 CPM) | |
* [JAN28] SAN-ORD-STL-IAH-SAN: 4193 for $127.20 (3.03 CPM) | |
* [FEB01] SAN-DEN-BNA, BNA-IAH-SAN: 3826 for $140.20 (3.66 CPM) | |
* [FEB05] SAN-SFO-EWR-PHL, PHL-EWR-SFO-SAN: 7130 (7130 PQM) for $218.80 (3.07 CPM) | |
* [FEB08] SAN-ORD-STL-SFO-SAN: 4458 for $128.70 (2.89 CPM) | |
* [FEB11] SAN-IAH-ORD-MCI, MCI-ORD-SFO-SAN: 5574 for $145.30 (2.61 CPM) | |
* [FEB17] SAN-EWR-ZFV, ZFV-EWR-SAN: 5350 (4850 PQM) for $140.70 (2.63 CPM) | |
* [FEB21] SAN-EWR-ZFV, ZFV-EWR-SAN: 5350 (4850 PQM) for $140.70 (2.63 CPM) | |
* [MAR02] SAN-EWR-ZFV, ZFV-EWR-SAN: 5350 (4850 PQM) for $140.70 (2.63 CPM) | |
* [MAR04] SAN-EWR-ZFV, ZFV-EWR-SAN: 5350 (4850 PQM) for $140.70 (2.63 CPM) |
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 Project | |
def penguin | |
self.class.where(:something => parent_object.something) | |
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
// Generated from Ruby: | |
// JSON.pretty_generate Scale.all.map do |s| | |
// {:name => s.name, :modes => s.modes.inject({}) {|b,m| b[m.name] = m.tones.map(&:tone); b} } | |
// end | |
[ | |
{ | |
"name": "Major", |
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 "capybara/rails" | |
class PngRenderer | |
include Capybara::DSL | |
DEFAULT_PATH = Rails.root.join("public/images/rendered") | |
def initialize(url) | |
@url = url | |
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 "capybara/rails" | |
Capybara.javascript_driver = :webkit | |
class StaffToPng | |
@queue = :staff_to_png | |
def self.perform(chord) | |
visit "/chords/#{chord}" | |
page.driver.render "generations/#{chord}.png" |
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 City | |
def freezing? | |
case name | |
when "San Diego" | |
current_temperature < 60 | |
when "Austin" | |
current_temperature < 50 | |
when "Rochester" | |
current_temperature < -10 | |
else |
NewerOlder