Skip to content

Instantly share code, notes, and snippets.

View yllus's full-sized avatar

Sully Syed yllus

View GitHub Profile
.site-title {
display: none;
}
@yllus
yllus / brightcove-videojs-tasks.js
Created February 1, 2016 20:57
JavaScript code we load on all pages that use the new VideoJS-based Brightcove video player
var CFLVideo = window.CFLVideo || {};
CFLVideo.Brightcove = (function() {
var _this, _element, _players = [];
function displayAds( video_player_id ) {
var player = videojs( video_player_id );
// If ads are disabled for this video, exit immediately.
if ( typeof player.options().disableads !== 'undefined' ) {
if ( player.options().disableads == 'true' ) {
@yllus
yllus / gist:ec39c145f0cf016c5057
Last active February 3, 2016 20:22 — forked from Bouke/gist:10454272
Install FreeTDS, unixODBC and pyodbc on OS X

First, install the following libraries:

$ brew install unixodbc
$ brew install freetds --with-unixodbc

FreeTDS should already work now, without configuration:

$ tsql -S [IP or hostname] -U [username] -P [password]
locale is "en_US.UTF-8"

locale charset is "UTF-8"

We're using a modified version of the Brightcove Video Cloud WordPress plug-in to use a new post type in our WordPress site called Video (the post type tag is bc-video). Our workflow is pretty simple - we ask that our video production staff upload new video content into Brightcove at https://studio.brightcove.com/ , and set the video's title, description and tags (more on that in a minute) before marking the video as active.

Once a video is active, it's eligible for the PHP script we have running on one of our webservers to see and create a Video post in WordPress out of. We have a tiny Bash script called cron_brightcove.sh that simply contains these lines:

#!/bin/sh

cd /app/cflca/public/wp-content/plugins/brightcove-video-cloud/cmd/

The sponsor image can be retrieved at:

http://pubads.g.doubleclick.net/gampad/ad?iu=/103711331/CFL_Mobile_App_Week_Sponsor&sz=380x60&t=slot%3Dad-schedule-week-11&c=[correlator]

The link that should be navigated to if tapped:

http://pubads.g.doubleclick.net/gampad/jump?iu=/103711331/CFL_Mobile_App_Week_Sponsor&sz=380x60&t=slot%3Dad-schedule-week-11&c=[correlator]

A few quick notes:

Example URL:

Bearing in mind I want an accurate Games Played (GP) state, here's the SQL of how I'm calculating the field goal numbers for Anthony Alix:

SELECT Game.Season as season, 
Club.Code AS team_abbreviation, 
COUNT(Game.GameID) AS games_played, 

SUM(StatGameFieldGoal.[Field Goals]) AS field_goals_attempts,

127.0.0.1 local-en.montrealalouettes.com # MAMP PRO - Do NOT remove this entry!
::1 local-en.montrealalouettes.com # MAMP PRO - Do NOT remove this entry!
127.0.0.1 local-www.stampeders.com # MAMP PRO - Do NOT remove this entry!
::1 local-www.stampeders.com # MAMP PRO - Do NOT remove this entry!
127.0.0.1 local-www.riderville.com # MAMP PRO - Do NOT remove this entry!
::1 local-www.riderville.com # MAMP PRO - Do NOT remove this entry!
127.0.0.1 local-www.argonauts.ca # MAMP PRO - Do NOT remove this entry!
::1 local-www.argonauts.ca # MAMP PRO - Do NOT remove this entry!
127.0.0.1 local-www.bclions.com # MAMP PRO - Do NOT remove this entry!
::1 local-www.bclions.com # MAMP PRO - Do NOT remove this entry!

To get back an XML document containing the "VAST2" ad response, call the URL provided in the video feed's JSON data at meta->url_vast2 ( http://www.cfl.ca/?feed=feed-youi-videos&page[number]=1&page[size]=20 ), which will look like:

https://pubads.g.doubleclick.net/gampad/ads?sz=1280x720&iu=/103711331/CFL_Mobile_App_Video&cust_params=[key_values]&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&correlator=[timestamp]

A few quick notes:

  • The string "[ad_category_params]" (without quotes) needs to be URL encoded (see https://support.google.com/dfp_premium/answer/1080597 ). It should have the form of app_section=val, and where val is should be the name of the Video Category of the video being viewed. Some examples:
    • app_section%3D103rd%20Grey%20Cup
    • app_section%3D2015%20Game%20Recaps
  • app_section%3D%23KegSize%20Plays%20of%20the%20Week
@yllus
yllus / QUERIES.md
Last active May 9, 2016 15:39
PowerPivot queries against CFL Connect

To get game-by-game Passing data:

SELECT Player.CFLCentralID, 
Game.Season AS season, 
Game.GameID AS game_id, 
MAX(Game.GameTypeID) AS game_type_id, 
MAX(Game.GameDay) AS game_date, 
MAX(Game.WeekNum) AS week, 
MAX(HomeClub.Code) AS home_team_abbreviation, 

MAX(VisitorClub.Code) AS visitor_team_abbreviation,

@yllus
yllus / cfl_pickem_ads.md
Last active May 17, 2016 21:42
Ad spot HTML for the CFL Pick'em website.

To display any of these ad spots, you'll need to put this code in the header of your site:

<script type='text/javascript'>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
  var gads = document.createElement('script');
  gads.async = true;
  gads.type = 'text/javascript';

var useSSL = 'https:' == document.location.protocol;