2.5 Addons and a Call for Help.
Pagination Addon for Ember CLI.
Great documentation and test coverage.
Supports multiple types of pagination
load "lib/baseball_lottery.rb" | |
MGC.connect! :production | |
def big_hash | |
res = {} | |
(1..100).each do |i| | |
res[i] = {} | |
50.times do | |
res[i][rand(100000000000)] = rand(1000000000000).to_s | |
end |
library(rvest) | |
page <- html("http://www.sherdog.com/events/UFC-Fight-Night-MacDonald-vs-Saffiedine-35509") | |
rows <- page %>% | |
html_nodes("tr[itemprop=subEvent]") | |
for (row in rows) { | |
names <- row %>% | |
html_nodes("span[itemprop=name]") %>% | |
html_text() |
# pretending to fetch HTML | |
getBody <- function(url) { | |
if (url == "http://garbage.broken") return(0) | |
else return(paste("this is the html for ",url)) | |
} | |
sites.names <- c("Google","ESPN","Garbage","ROK") | |
sites.urls <- c("http://google.com","http://espn.com","http://garbage.broken","http://returnofkings.com") | |
sites.df <- data.frame(Name=sites.names, Url=sites.urls, stringsAsFactors=FALSE) |
import Ember from 'ember'; | |
import Mixin from './../../mixins/pagination'; | |
export | |
default Ember.ArrayController.extend(Mixin, { | |
// setup our query params | |
queryParams: ["page", "perPage", "filter", "order"], | |
// setup orders | |
selOrders: [{ | |
label: 'Recente', | |
value: 'created_at-asc' |
import Ember from 'ember'; | |
export default Ember.Mixin.create({ | |
changeOrder: function() { | |
this.get('model').setOtherParam('order',this.get('order')); | |
}.observes('order') | |
}); |
require 'open-uri' | |
require 'nokogiri' | |
def links | |
res = [] | |
doc = Nokogiri::HTML(open("http://www.perfectgame.org/Rankings/Players/Default.aspx?gyear=2015&num=500")) | |
doc.css("tr.ranking_row, tr.ranking_alt_row").each do |row| | |
row.css("td:eq(4) a").each do |link| | |
res << link.attr('href') |
require 'nokogiri' | |
require 'open-uri' | |
def players | |
list_of_players = [] | |
f = File.open("PGpage.htm") | |
doc = Nokogiri::HTML(f) | |
rows = doc.css("tr.ranking_row a text(), tr.ranking_alt_row") |
1153 Sure Gamble (Core Set) | |
1086 Hedge Fund (Core Set) | |
963 Jackson Howard (Opening Moves) | |
625 Corroder (Core Set) | |
593 Same Old Thing (Creation and Control) | |
586 Clone Chip (Creation and Control) | |
560 R&D Interface (Future Proof) | |
533 Diesel (Core Set) | |
529 Plascrete Carapace (What Lies Ahead) | |
526 NAPD Contract (Double Time) |
# the home team's win chance for a normal team not at a neutral field | |
def home_chance_normal(sim_context,away_team_arg,home_team_arg) | |
# away team dvoa, minus 5% if it's the divisional round | |
away = sim_context.dvoa(away_team_arg) - home_extra_bonus.to_f | |
# home team dvoa, capped at 40% | |
home = [0.40,sim_context.dvoa(home_team_arg)].min | |
# min_max(-0.35..0.35) restricts the value to between -35% and 35% | |
# abs_exp(2) squares it and returns the absolute value |