{{[{]?(.*?)[}]?}}
{{> components/templates/email/includes/email-tr-spacer }}
{{# deliveryAddress }}
/* | |
Test environment: | |
- node.js 10.5.0 | |
- macOS 10.13.5 | |
- MacBook Pro Late 2013 | |
- Ramda 0.25.0 | |
- RxJS 6.2.1 | |
Results (Babel transpiled): |
#!/usr/bin/env python3.6 | |
""" | |
Example usage: | |
$ python3.6 wvsqlite.py glove.840B.300d.txt | |
Produces an sqlite database at with byte strings of floats for each word vector, indexed by | |
token for fast lookup for vocabs much smaller than the embedding vocab (aka most real vocabs). | |
Float size can be set via FLOAT_BYTES env var, and can be 4 or 8, and LIMIT can be set to take |
import React from 'react'; | |
class ReducerComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
reducer = (state, action) => state; | |
dispatch = action => this.setState(state => this.reducer(state, action)); |
#!/usr/bin/env bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" |
A lot of people mentioned other immutable JS libraries after reading my post. I thought it would be good to make a list of available ones.
There are two types of immutable libraries: simple helpers for copying JavaScript objects, and actual persistent data structure implementations. My post generally analyzed the tradeoffs between both kinds of libraries and everything applies to the below libraries in either category.
Libraries are sorted by github popularity.
import React, { Component } from 'react'; | |
import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux'; | |
import { provide, connect } from 'react-redux'; | |
import thunk from 'redux-thunk'; | |
const AVAILABLE_SUBREDDITS = ['apple', 'pics']; | |
// ------------ | |
// reducers | |
// ------------ |
import Kefir from 'kefir'; | |
import {List, Stack} from 'immutable'; | |
import {comp, filter, map} from 'transducers-js'; | |
function register(stream, messageType, handler) { | |
let xform = comp( | |
filter(x => x.first() === messageType), | |
map(x => x.rest())); | |
stream.transduce(xform).onValue(handler); | |
} |
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
{ | |
// http://eslint.org/docs/rules/ | |
"ecmaFeatures": { | |
"binaryLiterals": false, // enable binary literals | |
"blockBindings": false, // enable let and const (aka block bindings) | |
"defaultParams": false, // enable default function parameters | |
"forOf": false, // enable for-of loops | |
"generators": false, // enable generators | |
"objectLiteralComputedProperties": false, // enable computed object literal property names |