Skip to content

Instantly share code, notes, and snippets.

View ryanwild's full-sized avatar
:shipit:

Ryan Wild ryanwild

:shipit:
View GitHub Profile
@ryanwild
ryanwild / loop.sh
Last active November 10, 2015 07:50
Bash Examples
#!/bin/bash
VALUES="value1","value2"
(IFS=,
for v in $VALUES; do
echo "$v"
done
)
@ryanwild
ryanwild / gist:31605fc4383f27249ceeb5c1dd24fac4
Created February 2, 2017 08:15 — forked from yoitsro/gist:8693021
Node + Restify + Passport + Sessions + WebSockets
var restify = require('restify');
// Authentication
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var sessions = require("client-sessions");
var server = restify.createServer();
server.use(restify.queryParser());
server.use(restify.bodyParser());
@ryanwild
ryanwild / App.js
Created April 6, 2017 12:46 — forked from tomatau/App.js
SSR React Router Redux Suggestion
import { Switch, Route } from 'react-router'
import { replace } from 'react-router-redux'
@connect(null, { replace })
class PrivateRoute extends React.Component {
componentWillMount() {
this.props.replace('/foo')
}
render() {
@ryanwild
ryanwild / iconv.docker
Created April 18, 2017 10:24 — forked from tristanlins/iconv.docker
Docker PHP extension recipes
FROM php:5.6-cli
RUN apt-get update \
&& apt-get install -y \
libfreetype6-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install iconv \
&& apt-get remove -y \
libfreetype6-dev \
&& apt-get install -y \
@ryanwild
ryanwild / transcode
Created May 5, 2017 08:41 — forked from datashaman/transcode
Convert anything to x264 .mp4
#!/usr/bin/env bash
#
# Usage:
# transcode filename [filename...]
#
# Video: anything -> x264
# Audio: copy
# Output: .mp4 alongside the source file(s)
#
# I live here: https://gist.github.com/datashaman/6866879e4ad07b0483e6efd9ea49d8a2
@ryanwild
ryanwild / getVideoImage.js
Created May 5, 2017 11:29 — forked from westc/getVideoImage.js
A function to grab the frame at a specific point within a video.
function getVideoImage(path, secs, callback) {
var me = this, video = document.createElement('video');
video.onloadedmetadata = function() {
if ('function' === typeof secs) {
secs = secs(this.duration);
}
this.currentTime = Math.min(Math.max(0, (secs < 0 ? this.duration : 0) + secs), this.duration);
};
video.onseeked = function(e) {
var canvas = document.createElement('canvas');
@ryanwild
ryanwild / css_regression_testing.md
Created May 5, 2017 22:16 — forked from cvrebert/css_regression_testing.md
Survey of screenshot-based CSS testing tools

Currently considering https://github.com/webdriverio/webdrivercss


Core Goals:

  • Can test in up-to-date versions of all major browsers
  • Can test on up-to-date versions of all major OSes
  • Can test in IE9 (because Bootstrap v4 will support IE9+)
  • Don't want to have to setup/maintain our own cluster of VMs running all the necessary OSes (and all the versions of Windows)
  • Workflow for management of reference/baseline/norm screenshots
@ryanwild
ryanwild / excelSheetsToJsonRows.js
Created May 10, 2017 10:37 — forked from SneakyPeet/excelSheetsToJsonRows.js
Get all rows from all sheets in a excel doc as json array
// Get all rows from all sheets in a excel doc as json array
// Assumes sheets have header rows
const XLSX = require('xlsx');
const jsonfile = require('jsonfile');
const R = require('ramda');
const getWorkbook = () => XLSX.readFile('./data/test.xlsx');
const pickSheetsByName = (workbook) => R.pick(workbook.SheetNames, workbook.Sheets);
@ryanwild
ryanwild / combinators.js
Created August 11, 2017 14:46 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));
@ryanwild
ryanwild / tutorial.md
Created July 17, 2018 12:46 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.