I hereby claim:
- I am caub on github.
- I am caub (https://keybase.io/caub) on keybase.
- I have a public key whose fingerprint is 252A 77AD 73A4 A8BC FF76 D655 303C 5F10 6F57 4D9B
To claim this, I am signing this object:
import React from 'react'; | |
/** | |
* Simple HOC, taking a fetcher function (returning a promise) then a Component | |
* @returns Component accepting a ({ data, error, loading }) => {..} function as children | |
*/ | |
export default fetcher => Component => | |
class extends React.PureComponent { | |
state = { loading: true, data: [], error: undefined }; |
#!/bin/bash | |
regexp='^[-+]?[0-9]*(\.[0-9]*)?$' | |
validateNumber() { | |
if [[ $1 == *[0-9]* && $1 =~ $regexp ]]; then | |
echo "$1" | |
else | |
printf >&2 '%s is not a valid number\n' "$1" | |
fi | |
} |
create table foo ( | |
id bigserial primary key, | |
prev bigint | |
); | |
insert into foo(id, prev) values | |
(1, NULL), | |
(2, 1), | |
(4, 2), | |
(12, 4), |
/** | |
This middleware enhances redux-thunk, to deal with asynchronous actions | |
conventions and usage: | |
- an action is a plain object `{type: TYPE_CONSTANT, value: ANY_VALUE}` or an array of those actions (handled by reducer) | |
- you can shape action creators as `queryArgs => promise` (where the promise returns an action) | |
- or `queryArgs => action` (where the action value is a promise). | |
examples: | |
const getProfile = id => ({ type: GET_PROFILE, value: fetchApi(`/profile/${id}`) }); |
create table foo ( | |
id bigserial primary key, | |
name text, | |
created date | |
); | |
insert into foo(name,created) values | |
('lol', '2018-01-09'), | |
('lol', '2018-01-08'), | |
('lol', '2018-01-08'), |
// https://codesandbox.io/s/jznpj65nm5 | |
// ------- index.js | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
import Hello from './Hello'; | |
import DataProvider from './DataProvider'; | |
import * as data from './dataStore'; | |
const styles = { |
I hereby claim:
To claim this, I am signing this object:
diff --git a/bin/cli.js b/bin/cli.js | |
index 9dc79f9..cf68699 100755 | |
--- a/bin/cli.js | |
+++ b/bin/cli.js | |
@@ -33,11 +33,23 @@ function checkLocalModule(env) { | |
} | |
function initKnex(env) { | |
- | |
checkLocalModule(env); |
const { Store } = require('express-session'); | |
const { knex } = require('.'); | |
class PGStore extends Store { | |
destroy(sid, cb) { | |
return knex('sessions').where('id', sid).delete().then(() => cb()); | |
} | |
get(sid, cb) { | |
// console.log('get', sid); |
// render .js files as templates (they must be function taking options as arguments and outputting a valid HTML string) | |
app.engine('js', function (filePath, options, callback) { | |
if (process.env.NODE_ENV !== 'production') { | |
require.cache[filePath] = undefined; // invalidate require cache in dev | |
} | |
callback(null, require(filePath)(options)); // note: should wrap in a safeHtml in prod | |
}); | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'js'); |