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
% https://statistics.worldcubeassociation.org/database-query | |
SELECT Persons.wca_id, Persons.name, gold.total AS gold, silver.total AS silver, bronze.total AS bronze FROM Persons | |
LEFT JOIN ( | |
Select personId, count(*) total from Results where roundTypeId IN ('c', 'f') AND pos = 1 AND best > 0 AND countryId = 'Spain' GROUP BY personId | |
) AS gold ON Persons.wca_id = gold.personId | |
LEFT JOIN ( | |
Select personId, count(*) total from Results where roundTypeId IN ('c', 'f') AND pos = 2 AND best > 0 AND countryId = 'Spain' GROUP BY personId | |
) AS silver ON Persons.wca_id = silver.personId | |
LEFT JOIN ( |
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
Africa/Algiers | |
Africa/Cairo | |
Africa/Casablanca | |
Africa/Harare | |
Africa/Johannesburg | |
Africa/Monrovia | |
Africa/Nairobi | |
America/Argentina/Buenos_Aires | |
America/Bogota | |
America/Caracas |
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
# before running, download and unzip the latest TSV export from https://www.worldcubeassociation.org/results/misc/export.html | |
# usage: cat WCA_export_Results.tsv | ruby spanish_podia.rb | |
s = gets | |
s.chomp! | |
headers = {} | |
s.split("\t").each_with_index do |header, i| | |
headers[header] = i | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://code.jquery.com/jquery-2.2.4.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.radio/2.0.0/backbone.radio.js"></script> |
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
1 Madrid 3.207.247 Comunidad de Madrid Flag of the Community of Madrid.svg Comunidad de Madrid | |
2 Barcelona 1.611.822 Barcelona Flag of Catalonia.svg Cataluña | |
3 Valencia 792.303 Valencia Flag of the Valencian Community (2x3).svg Comunidad Valenciana | |
4 Sevilla 700.169 Sevilla Flag of Andalucía.svg Andalucía | |
5 Zaragoza 682.004 Zaragoza Flag of Aragon.svg Aragón | |
6 Málaga 568.479 Málaga Flag of Andalucía.svg Andalucía | |
7 Murcia 438.246 Región de Murcia Flag of the Region of Murcia.svg Murcia | |
8 Palma de Mallorca 398.162 Islas Baleares Flag of the Balearic Islands.svg Islas Baleares | |
9 Las Palmas de G. C. 383.050 Las Palmas Flag of the Canary Islands (simple).svg Canarias | |
10 Bilbao 349.356 Vizcaya Flag of the Basque Country.svg País Vasco |
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
map = %Q{ | |
function() { | |
emit("" + this.year + this.month, 1) | |
} | |
} | |
reduce = %Q{ | |
function(key, values) { | |
return 1; | |
} |
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 PocController | |
before_filter :redirect_to_root_url, only: :show4 | |
def show1 | |
redirect_to_root_url | |
render # => Double render error!!! | |
end | |
def show2 | |
redirect_to_root_url |
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
is 1 == 1? <%= yesno 1 == 1 %> | |
is 1 == 2? <%= yesno 1 == 2 %> |
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
2.0.0-p451 :016 > def omg(foo: 42, bar: "hello world!") | |
2.0.0-p451 :017?> puts [foo, bar].inspect | |
2.0.0-p451 :018?> end | |
=> nil | |
2.0.0-p451 :019 > omg | |
[42, "hello world!"] | |
=> nil | |
2.0.0-p451 :020 > omg(1, "one") |
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
module ActiveRecord | |
class Base | |
def self.scope(name, callable) | |
define_singleton_method name do | |
options = callable.respond_to?(:call) ? callable.call : callable | |
puts "Fetching records with options #{options.inspect}" | |
end | |
end | |
end | |
end |
NewerOlder