View Gruntfile.js
/*globals module, grunt*/ | |
'use strict'; | |
module.exports = function (grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
watch: { |
View famousjs-lesson101(starterKit-picasa-album)
define(function(require, exports, module) { | |
var SlideData = { | |
picasaUrl: 'https://picasaweb.google.com/data/feed/api/all', | |
queryParams: '?kind=photo&q=puppy&max-results=5&imgmax=720&alt=json', | |
defaultImage: 'https://lh4.googleusercontent.com/-HbYp2q1BZfQ/U3LXxmWoy7I/AAAAAAAAAJk/VqI5bGooDaA/s1178-no/1.jpg' | |
}; | |
SlideData.getUrl = function() { | |
return SlideData.picasaUrl + SlideData.queryParams; | |
}; |
View jquery.ba-tinypubsub.js
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011 | |
* http://benalman.com/ | |
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */ | |
(function($) { | |
var o = $({}); | |
$.subscribe = function() { | |
o.on.apply(o, arguments); |
View gist:5188729
var link = document.createElement('link'), | |
script = document.createElement('script'); | |
link.href = 'http://vjs.zencdn.net/c/video-js.css'; | |
link.rel = 'stylesheet'; | |
document.body.appendChild(link); | |
script.src = 'http://vjs.zencdn.net/c/video.js'; | |
script.onload = function() { | |
var video = document.createElement('video'); |
View gist:6232505
<?php | |
$facebook = new Facebook(array( | |
'appId' => 'xxxxx', | |
'secret' => 'xxxxx' | |
) | |
); | |
$facebook->setExtendedAccessToken(); | |
$access_token = $facebook->getAccessToken(); |
View timed-recursive-calls-with-timer.babel.js
let global = { | |
stop: false | |
} | |
const timedCaller = (params) => { | |
params.debug && console.log('[DEBUG ' + params.name + '] fn call') | |
// Test condition, if true run the callback | |
if (params.condition.test()) { | |
params.debug && console.log('[DEBUG ' + params.name + '] condition test passed!') | |
if (typeof params.condition.callback === 'function') { | |
params.debug && console.log('[DEBUG ' + params.name + '] callback is fn, should call!') |
View optimizelyExperiment
import React, { PropTypes } from 'react' | |
export const insertScriptHelper = (projectId) => { | |
const el = document.querySelector('[data-optimizely-snippet]') | |
if (!isReadyHelper() && !el) { | |
const protocol = `${document.location.protocol}//` | |
const scriptTag = document.createElement('script') | |
scriptTag.type = 'text/javascript' | |
scriptTag.async = true | |
scriptTag.src = `${protocol}cdn.optimizely.com/js/${projectId}.js` |
View javascript
<div id="fb-root"></div> | |
<script> | |
window.fbAsyncInit = function() { | |
FB.init({ | |
appId: 'xxxxxxxxxxxxx', | |
status: true, | |
cookie: true, | |
xfbml: true | |
}); |