Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Richard van der Dys dijs

🏠
Working from home
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am dijs on github.
  • I am dijs (https://keybase.io/dijs) on keybase.
  • I have a public key ASAwfYz8pR__vxK7rmaK-yFUWJFuB11izKq98hOv6ZDjJwo

To claim this, I am signing this object:

@dijs
dijs / get.js
Created Apr 16, 2017
Get implementation
View get.js
function get(obj, path, def) {
const parts = path.split('.');
const [first,] = parts;
const value = obj[first];
if (parts.length === 1) {
return value || def;
}
return get(value, parts.slice(1).join('.'), def);
}
View Conditional Chains.carbide.md

Conditional Chains

This Gist was automatically created by Carbide, a free online programming environme

@dijs
dijs / jsdom-iframe-test.js
Created Jul 20, 2016
Example of testing iframe messaging using jsdom
View jsdom-iframe-test.js
import { expect } from 'chai';
import jsdom from 'jsdom';
describe('JSDOM', () => {
it('should communicate with inner iframes', done => {
jsdom.env({
url: "http://bar.com/",
done (err, window) {
var frame = window.document.createElement('iframe');
window.document.body.appendChild(frame);
@dijs
dijs / react-containers-and-components.md
Created Jan 4, 2016
React Containers and Components
View react-containers-and-components.md

Redux is done a bit differently...

Containers

  • Fetch data
  • Manage data
  • Show fetching errors, loading, and UI
  • Compose these

Components (Dumb)

  • Only use props for data
@dijs
dijs / gist:4f93be50064c9f326c3c
Created Nov 30, 2015
Link Grammar Make Error
View gist:4f93be50064c9f326c3c
Undefined symbols for architecture x86_64:
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<int, std::__1::allocator<int> >::__append(unsigned long) in libsat-solver.a(sat-encoder.o)
void std::__1::vector<PositionConnector*, std::__1::allocator<PositionConnector*> >::__push_back_slow_path<PositionConnector* const>(PositionConnector* const&) in libsat-solver.a(sat-encoder.o)
void std::__1::vector<std::__1::pair<PositionConnector const*, PositionConnector const*>, std::__1::allocator<std::__1::pair<PositionConnector const*, PositionConnector const*> > >::__push_back_slow_path<std::__1::pair<PositionConnector const*, PositionConnector const*> const>(std::__1::pair<PositionConnector const*, PositionConnector const*> const&) in libsat-solver.a(sat-encoder.o)
void std::__1::vector<WordTag, std::__1::allocator<WordTag> >::__push_back_slow_path<WordTag const>(WordTag const&) in libsat-solver.a(sat-encoder.o)
WordTag::WordTag(WordTa
@dijs
dijs / gist:2ae366f4948177b3fdb6
Created Nov 30, 2015
Link Grammar configure output
View gist:2ae366f4948177b3fdb6
link-grammar-5.3.1 build configuration settings
prefix: /usr/local
C compiler: gcc -DUSE_SAT_SOLVER=1 -DHAVE_SQLITE=1 -g -O2 -O3 -std=c99 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE -arch x86_64
C++ compiler: g++ -DUSE_SAT_SOLVER=1 -DHAVE_SQLITE=1 -g -O2 -O3 -Wall -std=c++03
autopackage relocatable binary: no
Posix threads: no
Editline command-line history: no
UTF8 editline support: no
Java libraries: no
@dijs
dijs / bond.js
Created Nov 16, 2015
Spying on James Bond
View bond.js
import 'babel-polyfill'
import Wiki from './dist/wiki'
import Knwl from 'knwl.js'
let knwlInstance = new Knwl('english')
knwlInstance.register('dates', require('./node_modules/knwl.js/default_plugins/places'));
let wiki = new Wiki({
uri: 'http://jamesbond.wikia.com/api.php'
})
@dijs
dijs / thursday-talk_11-11-2015.md
Last active Nov 19, 2015
Continuous Improvement: Development with ES(6-7), React and Redux
View thursday-talk_11-11-2015.md

Continuous Improvement: Development with ES(6-7) / React / Redux

ES(6-7)

  • Adopt on the technology radar from Thoughtworks
  • More functional, easier to follow techniques (async/await)
  • No more waiting for new code features with Babel.io
  • New techniques promote better predictability and reusable code
  • Demo
  • All features https://ponyfoo.com/articles/es6
@dijs
dijs / async-for-each.md
Created Oct 27, 2015
Async/await do for each ideas
View async-for-each.md

ES7's async/await is awesome!

But, in order to use it well, you need to think in promises.

First thought:

async function something() => {
  let state = []
 await [1, 2, 3].forEach(async(n) =&gt; {