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
<?php | |
class AhrMovesNotificationsHandler { | |
public function __construct() { | |
add_action('rest_api_init', function() { | |
register_rest_route('moves/v1', '/notify', array( | |
'methods' => 'POST', | |
'callback' => array($this, 'on_receive_update'), | |
)); |
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
Parse.Cloud.beforeSave('rating', function(request, response) { | |
/** | |
* Ensure that the video is shortlisted | |
*/ | |
var videoId = request.object.get('video') | |
var videoQuery = new Parse.Query('video'); | |
videoQuery.get(videoId).then(function(video) { | |
if ( !video.get('shortlisted') ) { |
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
// Events (Plucked out of backbone.js source) | |
// --------------- | |
// A module that can be mixed in to *any object* in order to provide it with | |
// a custom event channel. You may bind a callback to an event with `on` or | |
// remove with `off`; `trigger`-ing an event fires all callbacks in | |
// succession. | |
// | |
// var object = {}; | |
// _.extend(object, Backbone.Events); |
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 _ from 'underscore'; | |
import '../lib/gsap/TweenMax'; | |
import '../lib/preloadjs-0.6.1.combined'; | |
import EventEmitter from '../util/event-emitter'; | |
class CanvasPlayer { | |
constructor(opts) { | |
this.opts = _.defaults(opts || {}, this.getDefaultOpts()); | |
this.state = this.getInitialState(); |
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
{ | |
"name": "google-analytics-plugin", | |
"version": "1.0.0", | |
"private": true, | |
"scripts": { | |
"test:lint": "eslint ./scripts", | |
"dev-js": "webpack --config webpack-dev.config.js --progress --profile --colors --watch", | |
"build-js": "webpack --config webpack-production.config.js --progress --colors", | |
"dev": "npm run dev-js", | |
"build": "npm run test:lint && npm run build-js" |
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
/** | |
* Promise-based wrapper around fetch that will reject promises for | |
* requests that fail with a non-200 response code. | |
*/ | |
import _ from 'underscore' | |
import Promise from 'promise' | |
const getDefaultOpts = () => { | |
return { | |
type: 'json' |
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 Promise from 'promise' | |
export const loadPolyfills = () => { | |
return new Promise((resolve) => { | |
let promises = [] | |
if ( !global.fetch ) { | |
promises.push(new Promise((subResolve) => { | |
require(['whatwg-fetch'], subResolve) | |
})) |
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 $ from 'jquery' | |
export default class ImageLoader { | |
constructor(images) { | |
if ( typeof images === 'string' ) { | |
images = [images]; | |
} | |
let promises = images.map(this.loadImage); | |
return $.when.apply($, promises); |
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
<?php | |
function parse_get($url) { | |
$app_id = 'PARSE_APP_ID'; | |
$api_key = 'PARSE_API_KEY'; | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |