Skip to content

Instantly share code, notes, and snippets.

View bredfern's full-sized avatar

Brian Redfern bredfern

View GitHub Profile
@bredfern
bredfern / GStreamer-1.0 some strings.sh
Created October 25, 2017 08:18 — forked from strezh/GStreamer-1.0 some strings.sh
GStreamer-1.0 personal cheat sheet
#!/bin/bash
# play YUV444 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
videoparse width=1920 height=1080 framerate=25/1 format=GST_VIDEO_FORMAT_Y444 ! \
videoconvert ! \
autovideosink
# play YUV422 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
@bredfern
bredfern / jquery.scrollToTop.js
Created July 13, 2017 03:02 — forked from monkeymonk/jquery.scrollToTop.js
ES6 jQuery plugin definition
import $ from 'jquery';
import plugin from './plugin';
class ScrollToTop {
constructor(element, options) {
const $element = $(element);
$(window).scroll(function () {
if ($(this).scrollTop() > options.offset) {
$element.fadeIn();
@bredfern
bredfern / function_invocation.js
Created April 3, 2017 03:51 — forked from myshov/function_invocation.js
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@bredfern
bredfern / index.js
Created January 30, 2017 23:59 — forked from Fedia/index.js
🌀 Eddy: Static Websites For The Rest of Us
//- polyfills
'use strict';
(function (p) {
if (!p.matches) p.matches = p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector;
})(Element.prototype);
if (typeof window.CustomEvent !== 'function') {
window.CustomEvent = function (name, p) {
p = p || {};
@bredfern
bredfern / tf_beam_decoder.py
Created November 7, 2016 19:41 — forked from nikitakit/tf_beam_decoder.py
Tensorflow Beam Search
"""
Beam decoder for tensorflow
Sample usage:
```
beam_decoder = BeamDecoder(NUM_CLASSES, beam_size=10, max_len=MAX_LEN)
_, final_state = tf.nn.seq2seq.rnn_decoder(
[beam_decoder.wrap_input(initial_input)] + [None] * (MAX_LEN - 1),
@bredfern
bredfern / html5-video-streamer.js
Created December 8, 2015 00:43 — forked from paolorossi/html5-video-streamer.js
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
/* Trello Node.js Developer Challenge - Solution
*
* https://trello.com/jobs/developer
*
* If hash is defined by the following pseudo-code:
*
* Int64 hash (String s) {
* Int64 h = 7
* String letters = "acdegilmnoprstuw"
* for(Int32 i = 0; i < s.length; i++) {
Tempo-Synced LFO Wobble Bass
Jacob Joaquin
July 10, 2011
jacobjoaquin@gmail.com
csoundblog.com
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 44100
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">