Skip to content

Instantly share code, notes, and snippets.

View thomastuts's full-sized avatar

Thomas Tuts thomastuts

View GitHub Profile

I'm working on an application that plays audio clips. The audio clips that are currently playing are stored in the Redux store (you can play more than one clip at once). Everything is working just fine, but I'm wondering what the cleanest way to play/stop the audio would be. (See below JS files for the full source of my store and audio manager file)

Currently, I am triggering the play/stop actions from within the store itself, but this feels kind of wrong:

// store.js

// ...
case 'AUDIO_PLAY':
      const audioObject = createAudioObject({
@thomastuts
thomastuts / bundle.js
Created April 1, 2015 18:10
Gulp workflow with Browserify, Babel, React & BrowserSync
// tasks/bundle.js
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var concat = require('gulp-concat');
'use strict';
angular
.module('test')
.factory('Animal', function () {
function Animal(name) {
this.name = name;
}
@thomastuts
thomastuts / gulpfile.js
Created February 27, 2015 14:25
Splitting up Gulp tasks in separate files
// gulpfile.js
var gulp = require('gulp');
var requireDir = require('require-dir');
var tasks = requireDir('./tasks');
gulp.task('sass', tasks.sass);
gulp.task('serve:dev', tasks.serve.dev);
gulp.task('serve:dist', tasks.serve.dist);
app/
├── index.html
└── src
├── app.js
├── bundle.js
├── common
│   ├── auth.js
│   ├── router.js
│   └── storage.js
├── components
'use strict';
angular.module('myAuthApp', [
'ui.router'
])
.config(function ($urlRouterProvider, $stateProvider) {
$stateProvider
.state('login', {
url: '/signin',
templateUrl: 'src/views/auth/partials/login.html',
gulp.task('bundle:source', function () {
return es.merge(
gulp.src('src/scripts/**/*.html')
.pipe(templateCache({
module: 'myModule',
root: 'scripts'
})),
gulp.src([
'src/scripts/app.js',
var gulp = require('gulp');
var open = require('gulp-open');
var karma = require('karma').server;
var protractor = require('gulp-protractor').protractor;
var paths = require('./paths');
module.exports = {
unit: function (done) {
karma.start({
configFile: paths.tests.unit.config,
var gulp = require('gulp');
var path = require('path');
var paths = require('./paths');
var concat = require('gulp-concat');
var sourceMaps = require('gulp-sourcemaps');
var mainBowerFiles = require('main-bower-files');
var sourceOrdered = [
'!' + path.join(paths.scripts, 'bundle.js'),
'!' + path.join(paths.scripts, 'vendor.js'),
@thomastuts
thomastuts / gist:7c35d748e558c4936ff8
Last active August 29, 2015 14:05
Adding files mid-stream in Gulp
var path = require('path');
var gulp = require('gulp');
var concat = require('gulp-concat');
var templateCache = require('gulp-angular-templatecache');
var addsrc = require('gulp-add-src');
var paths = {
src: 'public/assets/src'
};