Skip to content

Instantly share code, notes, and snippets.

View scottcorgan's full-sized avatar
💭
Not coding

Scott Corgan scottcorgan

💭
Not coding
  • Tamarack
  • Shelbyville, KY
View GitHub Profile
@scottcorgan
scottcorgan / redux-devtools-separate-window.js
Last active August 29, 2015 14:27 — forked from tlrobinson/redux-devtools-separate-window.js
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
// 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 >
@scottcorgan
scottcorgan / gulpfile.js
Last active August 29, 2015 14:10
Divshot local with LiveReload and Gulp
var livereload = require('gulp-livereload'),
superstatic = require('superstatic'),
dest = 'build';
gulp.task('server', function(next) {
var server = superstatic();
next();
});
gulp.task('watch', ['server'], function() {
@scottcorgan
scottcorgan / constructor.js
Created November 20, 2014 00:53
Douglas Crockford's new constructor without using new
function constructor(spec) {
let { member } = spec,
{ other } = other_constructor(spec),
method = function() {
// member, other, methid, spec
};
return Object.freeze({
method,
other
<my-element></my-element>
<my-element></my-element>
// 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);
// 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
});
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) {
at=error code=H18 desc="Request Interrupted" method=PUT path=/builds/3ff67c20247307921a1582ac6277bc0b546255c19780ab31404eb63fdc218d97/tar.gz host=loadpoint.divshot.com fwd="76.94.26.13" dyno=web.2 connect=1ms service=17813ms status=503 bytes=643535 sock=backend
@scottcorgan
scottcorgan / fasten.js
Created November 19, 2013 23:34
Fasten.io embed
var fasten = Fasten.connect('your/fasten/hook/path', 'some_crazy_long_token_from_fasten');
fasten.hook(function (data) {
// Do amazing stuff here!
});