Skip to content

Instantly share code, notes, and snippets.

View mfandl's full-sized avatar

Matej Fandl mfandl

View GitHub Profile
@mfandl
mfandl / file.cc
Created February 9, 2018 20:59
openFrameworks + ofxVideoRecorder setup to record video with h264
/**
* openFrameworks + ofxVideoRecorder setup to record video with h264
* You will need ffmpeg and libx264 in your system. On mac, you can use homebrew.
* reason for yuv420p:
* 'QuickTime only supports YUV planar color space with 4:2:0 chroma subsampling (use -vf format=yuv420p or -pix_fmt yuv420p) for H.264 video.'
* as mentioned here: https://trac.ffmpeg.org/wiki/Encode/H.264
*/
recorder.setVideoCodec("libx264");
string fileName = ofToDataPath("v" + ofGetTimestampString() + ".mp4");
@mfandl
mfandl / init.vim
Last active March 19, 2018 14:31
my neovim config
set number
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set nofoldenable
let g:mapleader = ','
let g:ale_fixers = {
\ 'javascript': ['eslint']
// this productivity app blurs parts of aby webpage that are currently not important for you to read
// to use it, open devtools with f12, copy the following line to the console and hit enter.
Array.prototype.forEach.call(document.getElementsByTagName('*'), e => e.style.filter = `blur(${Math.random() < 0.95 ? 0 : 4}px)`)
// Output down
const arr = [
{ value: 1 },
{ value: 2 },
{ value: 3 },
undefined,
{ value: 5 },
{ value: 6 }
];
const obj = {a : 2}
const fn = propName => ({ [propName]: prop }) => prop == 2
console.log(fn('a')(obj))
@mfandl
mfandl / lesson1.clj
Last active August 1, 2018 21:23
clojure school lesson 1 recap and exercises
;; WIP material
;; RECAP
; clojure expressions are lists
; syntactically, lists are values in parentheses delimited by white space
(1 2 3)
; clojure expects each expression is built in such a way,
; that the first element is a function name followed by its arguments
const finishedLevelsCount = levels
.filter(({ finished }) => finished)
.reduce(acc => acc + 1, 0);
const propertyExtractor = propName => ({ [propName]: prop }) => prop
const idExtractor = propertyExtractor('id')
const nameExtractor = propertyExtractor('name')
const convict = { id: 7556, name: 'ash' }
console.log(idExtractor(convict), nameExtractor(convict)) // 7556 "ash"
[
{
"creationDate": "2018-10-24 12:24:51 +0100",
"value": "81"
},
{
"creationDate": "2018-10-24 12:24:55 +0100",
"value": "78"
},
{
set number
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set nofoldenable
let g:mapleader = ','
filetype plugin on