Skip to content

Instantly share code, notes, and snippets.

diff --git a/src/configurator/configurator.js b/src/configurator/configurator.js
index 9dfcabb..3b18a36 100644
--- a/src/configurator/configurator.js
+++ b/src/configurator/configurator.js
@@ -108,41 +108,35 @@ function createHotReloadModifier(configItems) {
return null
}
- return (
-` if (argv.hot) {
ffmpeg -y -i video.webm -vf palettegen palette.png
ffmpeg -y -i video.webm -i palette.png -filter_complex paletteuse -r 10 animation.gif
Source: http://www.ubuntubuzz.com/2017/08/convert-mp4-webm-video-to-gif-using-ffmpeg.html
@jakoblind
jakoblind / managing-state.js
Last active March 28, 2017 09:23
Demonstration of two ways to manage React state. With recompose and with ES6 classes
// First we have our component which takes data and callback functions as props
const ProductDetails = ({ selectedColor, selectedSize, setSelectedColor, setSelectedSize }) => {
return (
<div>
<p>Selected color is: {selectedColor}</p>
<p>Selected size is: {selectedSize}</p>
<button onClick={() => setSelectedSize(64)}> set selected size 64</button>
<button onClick={() => setSelectedColor("green")}> set selected color to green </button>
</div>
);
@jakoblind
jakoblind / empty-component-hoc.js
Created March 20, 2017 10:13
React higher order component for empty component logic
//Problem description: I have a lot of small components that render an EmptyCartSection if a certain input prop is empty (different props for different components). The code looks like this:
const TotalMonthly = (({ cartContainsStuff, usefulProps }) => {
if (!cartContainsStuff) {
return <EmptyCartSection />;
}
return (
// The actual implementation. Not relevant here.
);
});
@jakoblind
jakoblind / redux-mini.js
Last active March 10, 2023 06:19
A mini redux implementation
/*
You need node 6.9 or later.
Run with:
node redux-mini.js --harmony
Want a more in depth explanation of how things works? Read the blog post I have written about it here:
http://blog.jakoblind.no/2017/03/13/learn-redux-by-coding-a-mini-redux/
*/
/*
const path = require("path");
const webpack = require('webpack');
const fs = require('fs');
module.exports = [{
entry: {
app: './frontend/js/app_client.jsx',
vendor: "react"
},

Keybase proof

I hereby claim:

  • I am jakoblind on github.
  • I am jakoblind (https://keybase.io/jakoblind) on keybase.
  • I have a public key whose fingerprint is 72E4 9FEA 3828 ADD5 8C22 8332 1E2D B16A 8775 C84A

To claim this, I am signing this object:

var list1 = [{a: 1}, {b: 2}, {c:3}];
var list2 = _.map(list1, function(i){
i = "test";
return "test";
});
//list1 is not changed but a new list is created:
//JSON.stringify(list1): "[{"a":1},{"b":2},{"c":3}]"
//JSON.stringify(list2); "["test","test","test"]"