Skip to content

Instantly share code, notes, and snippets.

View kilianc's full-sized avatar
🇮🇹

Kilian Ciuffolo kilianc

🇮🇹
  • San Francisco, CA
View GitHub Profile
@kof
kof / action-creator-vs-reducer.md
Last active January 18, 2020 09:06
Action creator vs. reducer

When should you use action creator and when reducer?

Action creator

  • you need to have side effects
  • you need to read from store to decide what to do
  • you need to dispatch more than one action
  • action produced by action creator needs to contain all the data reducer can need to shape the components state

Reducer

  • should not have any side effects
@acdlite
acdlite / convert-video-for-web.sh
Last active August 21, 2017 20:30
Convert videos for web
#!/bin/bash
# Based on http://asisolve.com/ffmpeg-encoding-settings-for-web-video/
for f in src/*.mov
do
name=$(basename $f .mov)
# Convert to mp4
ffmpeg -i $f -vcodec libx264 -preset slow -profile main -crf 25 -acodec libfdk_aac -ab 64k dist/$name.mp4
@dougalcampbell
dougalcampbell / ds-duino.ino
Created September 10, 2013 17:37
Digispark and nodejs - talking to the Digispark Arduino-compatible microcontroller via USB with the node-hid library
/*
* Accept control commands via USB.
*
* Commands start with '!' and end with '.'
* Commands have three parts: action, pin, value: !AAPPVV.
*
* E.g. '!01p101.' is DigitalWrite, Pin1, value = 1
*
* Note: This is currently *very* crude. Much improvement could be made.
* I think the use of strncpy is eating a lot of memory. Refactor?
(function( exports ) {
function EventEmitter() {}
EventEmitter.prototype.emit = function() {
var type, handlers, args, listeners;
type = arguments[0];
args = [].slice.call( arguments, 1 );