Skip to content

Instantly share code, notes, and snippets.

const choo = require('choo')
const html = choo.view
const onload = require('on-load')
const app = choo()
const page1 = (params, state, send) => {
const tree = html`
<div>
<h1>Page 1</h1>
const Nestable = require('react-nestable').default
const React = require('react')
const ReactDOM = require('react-dom')
const Nanocomponent = require('nanocomponent')
const css = require('sheetify')
css('react-nestable/dist/Nestable/Nestable.css')
css('react-nestable/dist/Icon/Icon.css')
module.exports = class TaskList extends Nanocomponent {
const html = require('bel')
window.CustomButton = function (props) {
console.log('Called CustomButton', props)
return html`
<button style="background-color: ${props.color}">
${props.label}
</button>
`
}
@timwis
timwis / api.apib
Created June 12, 2017 16:38
Dataface API spec
FORMAT: 1A
# Dataface
Build and manage data with a spreadsheet-like interface.
# Group Sheets
Resources related to sheets (which is what dataface calls database tables).
@timwis
timwis / get-schema.sql
Last active May 4, 2017 10:38
Get postgres table schema including keys/constraints
SELECT
cols.column_name,
cols.data_type,
cols.character_maximum_length,
cols.column_default,
cols.is_nullable::boolean,
constr.constraint_type,
pg_catalog.col_description(cls.oid, cols.ordinal_position::int)::jsonb
FROM
pg_catalog.pg_class cls,
@timwis
timwis / grid.js
Last active April 23, 2017 16:13
Combining HyperList with Nanocomponent
const html = require('choo/html')
const css = require('sheetify')
const HyperListComponent = require('./hyperlist-component')
const prefix = css`
thead, tbody {
display: block;
}
`
@timwis
timwis / docker-compose.yml
Last active April 12, 2017 11:36
PostgREST via docker-compose
version: '2'
services:
db:
image: postgres
volumes:
- ./scripts/contacts.sql:/docker-entrypoint-initdb.d/contacts.sql
ports:
- "5432:5432"
restart: always
environment:
const html = require('choo/html')
const component = require('nanocomponent')
const menu = require('../components/menu')
module.exports = function home (state, emit) {
return component({
render: (state, emit) => {
return html`
<body>
import React from 'react'
import 'foundation-sites/dist/css/foundation.css'
import TopBar from './TopBar'
class Layout extends React.Component {
render () {
<div className='container'>
<TopBar />
{this.props.children}
const html = require('bel')
['Hello', 'world'].map((text) => {
return html`<p><span>${text}</span></p>`
})