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
var bind = function (selector, event) { | |
return binder(selector, event); | |
}; | |
var binder = function (selector, event) { | |
var listeners = []; | |
document.querySelector(selector) | |
.addEventListener(event, function (e) { | |
listeners.forEach(function (listener) { |
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
// inside a function on the Divshot prototype | |
// it uses https://www.npmjs.org/package/promise under the hood | |
var promise = this.http._promiseWrap(function (resolve, reject) { | |
// resolve or reject in here | |
}); | |
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
// Server | |
var express = require('express'); | |
var app = express(); | |
var apiV1 = require('api-v1'); | |
app.user('/api/v1', apiV1.app); | |
app.user('/api/v2', apiV2.app); | |
app.listen(process.env.PORT || 9876); |
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
<my-element></my-element> |
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
<my-element></my-element> |
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
var livereload = require('gulp-livereload'), | |
superstatic = require('superstatic'), | |
dest = 'build'; | |
gulp.task('server', function(next) { | |
var server = superstatic(); | |
next(); | |
}); | |
gulp.task('watch', ['server'], function() { |
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
// give it a name so it reuses the same window | |
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no"); | |
// reload in case it's reusing the same window with the old content | |
win.location.reload(); | |
// wait a little bit for it to reload, then render | |
setTimeout(function() { | |
React.render( | |
<DebugPanel top right bottom left > |
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
var opts = { | |
log: require('./logger'), | |
fs: require('./fs') | |
}; | |
var someCommand( | |
name('something'), | |
use(function (data, flags, options) { | |
options.log('hey!'); | |
options.fs.write('something'); |
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
$campaigns = array(); | |
$sql = "SELECT * FROM svn_posts WHERE post_type = 'shirts' AND post_date < now() ORDER BY ID DESC LIMIT 10"; | |
$query = $this->db->query($sql); | |
// create organized arrays of campaign data | |
foreach($query->result() as $campaign){ | |
$sql = 'SELECT * FROM svn_postmeta WHERE post_id = ' . $campaign->ID; | |
$results = $this->db->query($sql)->result(); | |
$meta = array(); |
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
$(document).animate({ | |
scrollTop : 100 | |
}); |
OlderNewer