Skip to content

Instantly share code, notes, and snippets.

Greg B gregbenner

  • Cactus & Dove Ltd.
  • London, UK
Block or report user

Report or block gregbenner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gregbenner
gregbenner / app.vue
Last active Jun 7, 2018
dynamic images from a folder
View app.vue
<template>
<div v-for="(image, index) in images" :key="index">
<img :src='image' alt="image">
</div>
</template>
<script>
const { images } = process.env;
export default {
data() {
View transcodememaybe
// PACKAGE.JSON
{
"name": "transcoder",
"version": "1.0.0",
"description": "",
"main": "handler.js",
"dependencies": {
"fluent-ffmpeg": "^2.1.2",
"stream": "^0.0.2"
},
View ffmpeg openfaas
FROM ubuntu:latest
ADD https://github.com/openfaas/faas/releases/download/0.6.9/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
WORKDIR /tmp/ffmpeg
RUN apt-get -y update && apt-get -y dist-upgrade && apt-get -y install software-properties-common && add-apt-repository ppa:mc3man/trusty-media -y && apt-get -y install ffmpeg
ENV fprocess="ffmpeg fd:1"
HEALTHCHECK --interval=5s CMD [ -e /tmp/.lock ] || exit 1
CMD ["fwatchdog"]
# usage: echo "audio.mp3" | faas invoke ffmpeg > output.ogg
View ffmpeg trial
# DOCKERFILE
FROM ubuntu:latest
ADD https://github.com/openfaas/faas/releases/download/0.6.9/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
ENV FFMPEG_VERSION=3.0.2
WORKDIR /tmp/ffmpeg
RUN apt-get -y update && apt-get -y dist-upgrade && apt-get -y install software-properties-common
RUN add-apt-repository ppa:mc3man/trusty-media -y
RUN apt-get -y install ffmpeg
View keybase.md

Keybase proof

I hereby claim:

  • I am gregbenner on github.
  • I am cactusdove (https://keybase.io/cactusdove) on keybase.
  • I have a public key whose fingerprint is 3FDD CF59 0055 BE98 74FE D6A2 F87F DA19 9149 FF55

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am gregbenner on github.
  • I am gnb (https://keybase.io/gnb) on keybase.
  • I have a public key whose fingerprint is D75F C7E5 4F5C ED0A 8C48 741B C2E2 9D26 FBBB 0E0D

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am gregbenner on github.
  • I am gnb (https://keybase.io/gnb) on keybase.
  • I have a public key whose fingerprint is EBD2 A604 50C8 B0A5 ED72 12F5 1971 8C93 377A 45F9

To claim this, I am signing this object:

View SafeRead Nested Objects .js
//
// Usage... for a nested structure
// var test = {
// nested: {
// value: 'Read Correctly'
// }
// };
// safeRead(test, 'nested', 'value'); // returns 'Read Correctly'
// safeRead(test, 'missing', 'value'); // returns ''
//
@gregbenner
gregbenner / min-max-array.js
Created Jan 2, 2015
Smallest and LArgest number in an Array
View min-max-array.js
function smallest(array){
return Math.min.apply( Math, array );
}
function largest(array){
return Math.max.apply( Math, array );
}
assert(smallest([0, 1, 2, 3]) == 0, "Locate the smallest value.");
assert(largest([0, 1, 2, 3]) == 3, "Locate the largest value.");
@gregbenner
gregbenner / ensure-new-object-creation.js
Created Jan 2, 2015
Ensure new is used when creating objects
View ensure-new-object-creation.js
function User(first, last){
if ( !(this instanceof arguments.callee) )
return new User(first, last);
this.name = first + " " + last;
}
var name = "Resig";
var user = User("John", name);
You can’t perform that action at this time.