Skip to content

Instantly share code, notes, and snippets.

View marcusstenbeck's full-sized avatar
🤙
Crushing it.

Marcus Stenbeck marcusstenbeck

🤙
Crushing it.
View GitHub Profile
@marcusstenbeck
marcusstenbeck / clips_to_mosaic.sh
Created October 14, 2015 00:09
Take a bunch of input video clips and turn them into a video mosaic
#######################
# clips_to_mosaic.sh #
# Requires ffmpeg #
#######################
# This file contains video paths, one per line
FILE="infile.txt"
# Square tile size (pixels)
TILE_SIDE=108
@marcusstenbeck
marcusstenbeck / runner.js
Created September 26, 2016 11:47
T-rex Runner Game (Google Chrome)
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function() {
'use strict';
/**
* T-Rex runner.
* @param {string} outerContainerId Outer containing element id.
* @param {Object} opt_config
* @constructor
const { makeExecutableSchema } = require('graphql-tools');
const gql = require('graphql-tag');
const typeDefs = gql`
type Show {
title: String!
time: String!
host: String!
location: String!
}
const { makeExecutableSchema } = require('graphql-tools');
const { GraphQLDateTime } = require('graphql-iso-date');
const gql = require('graphql-tag');
const typeDefs = gql`
scalar DateTime
type Show {
title: String!
time: DateTime!
module.exports = makeExecutableSchema({
typeDefs,
resolvers: {
DateTime: GraphQLDateTime,
Query: {
allShows: () => [
{
title: 'Dance Party',
time: '2018-10-27T13:00:00Z',
host: 'Caramba',
module.exports = makeExecutableSchema({
typeDefs,
resolvers: {
DateTime: GraphQLDateTime,
Query: {
allShows: () => getShows()
},
Mutation: {
addShow: (_, data) => {
addShow(data);
module.exports = function addShow(data) {
// code to add show
};
module.exports = function getShows() {
return [];
};
const max50 = str => str.length <= 50;
module.exports = function addShow({ title, time, host, location }) {
if (!title || !max50(title)) {
throw new Error(`title can't be longer than 50 characters`);
}
if (!(time instanceof Date)) {
throw new Error(`time must be a date object`);
}
module.exports = {
createStore() {
let events = [];
return {
commit(event) {
events = [...events, event];
}
};
}
};