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
from django.conf import settings | |
from django.http import HttpResponse | |
from django.shortcuts import render | |
from dummyjson import views as dj | |
from gannettapi.api import api | |
from datetime import datetime | |
from dateutil.parser import parse | |
from dateutil.relativedelta import relativedelta | |
from ordereddict import OrderedDict | |
from relux import utils |
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
triggerRoute: function(e){ | |
var $targetLink = $(e.target).closest('a'), | |
href; | |
if (!$targetLink.length) return; | |
href = $targetLink.attr('href'); | |
if (href.indexOf('#') == 0 && href.length > 1) return; | |
App.setHeatTrack($targetLink); | |
if (Modernizr.history && this.isDefinedRoute(href) && href) { |
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
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
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
$.ajax({ | |
url: mapParams.url, | |
dataType: 'jsonp', | |
cache: true, | |
jsonpCallback: 'grid', | |
success: function(tilejson) { | |
var mapbox = new Connector(tilejson); | |
map.addLayer(mapbox); | |
mapbox.addEventListener('load', load); | |
} |
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
registerTaboolaClick: function(itemId, itemType, responseId, placement){ | |
var url = 'http://api.taboola.com/1.0/json/usatodaydemo/recommendations.notify-click' + | |
'?app.type=desktop&app.apikey=' + this.apiKey + '&response.id=' + responseId + | |
'&item.type=' + itemType + '&item.id=' + itemId; | |
if (placement) { | |
url += 'placement=' + placement; // below-photo or end-slate | |
} | |
new Image().src = 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
class BoxScores(object): | |
def __init__(self, data): | |
# boxscores key is required, let fail if not present | |
self.data = accum(data, 'boxscores') | |
def event(self): | |
return get_nested(self.data, 'event_metadata', 0, default=None) | |
def game_story(self): | |
story = get_nested(self.data, 'game_story', default={}) |
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
animateNewContent: function(fromPath, toPath, htmlFrag, paused){ | |
var currentWrap = this.$cards.eq(this.currentIndex); | |
var currentCard = currentWrap.children('.card'); | |
if (currentWrap.children('.ad_container1').length === 0){ | |
var ads = htmlFrag.find(".ad_container1"); | |
currentWrap.prepend(ads); | |
} | |
if (htmlFrag.find('.hero.bump').length) { | |
currentCard.find('.punchout-cover').addClass('show'); | |
} |
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
StateManager.fetchHtml('/services/money/jobs/categories/', { timeout: 10000 }).done(_.bind(function(html){ | |
this.$('.jobs-form-dropdown').append(html); | |
}, this)) | |
.always(function(){ | |
this.subviews.jobSearchForm = new SelectDropdown({ | |
el: this.$('.jobs-form-dropdown') | |
}); | |
}); |
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
def _scores(self, scores): | |
if not hasattr(scores, 'team_game_stats') or not hasattr(scores.team_game_stats, 'sub_score'): | |
return [] | |
widget_scores = [] | |
for score in scores.team_game_stats.sub_score: | |
try: | |
widget_scores.append(score.period_score) | |
except AttributeError: | |
widget_scores.append(0) | |
label = self.caption.get(self.league_key, self.caption['default']) |
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
from sh import git | |
# | |
# Command Being Run | |
# git --git-dir autodeploy_branchbuilder.git log --grep="Merge pull request #" release/2.0.. | grep "Merge pull request" | |
# | |
# Output Expected Sample | |
# Merge pull request #19 from GannettDigital/feature/update_conflicts | |
# Merge pull request #18 from GannettDigital/feature/bugsquash | |
# etc. |