Skip to content

Instantly share code, notes, and snippets.

View zzarcon's full-sized avatar
🦍
Generating legacy code

Hector Zarco zzarcon

🦍
Generating legacy code
View GitHub Profile
@zzarcon
zzarcon / index.jsx
Last active January 4, 2017 22:18
component: styles + allow deletion
/** @jsx h */
import 'skatejs-web-components';
import { Component, h, prop } from 'skatejs';
import styles from './styles';
class SKTags extends Component {
static props = {
delimiter: prop.string({attribute: true, default: ' '}),
tags: prop.array({attribute: true}),
@zzarcon
zzarcon / index.jsx
Last active January 4, 2017 22:18
Component: behavior + events
/** @jsx h */
import 'skatejs-web-components';
import { Component, h } from 'skatejs';
import styles from './styles';
class SKTags extends Component {
static props = {
delimiter: prop.string({attribute: true, default: ' '}),
tags: prop.array({attribute: true}),
@zzarcon
zzarcon / index.jsx
Last active January 4, 2017 22:19
Tags component registration
/** @jsx h */
import 'skatejs-web-components';
import { Component, h, prop } from 'skatejs';
import styles from './styles';
class SKTags extends Component {
static props = {
delimiter: prop.string({attribute: true, default: ' '})
}
@zzarcon
zzarcon / demo.js
Created September 26, 2016 07:28
new.target
function Foo() {
const t = eval('new.target');
if (!t) throw "Foo() must be called with new";
console.log("Foo instantiated with new");
}
@zzarcon
zzarcon / readme.md
Created September 22, 2016 16:07
Simplest JS module bundler setup for Tree-shaking

Installation

$ npm i browserify rollupify rollup-plugin-node-resolve -D

Usage

$ node_modules/.bin/browserify -t [ rollupify --config browserify-rollup.config.js ] index.js > main.js
@zzarcon
zzarcon / kakapo-crud.js
Created June 19, 2016 13:36
Kakapo CRUD
import {Database, Router, Server, Response as KakapoResponse} from 'Kakapo';
const sever = new Server();
const router = new Router();
const databse = new Database();
database.register('user', faker => {
return {
firstName: faker.name.firstName,
lastName: faker.name.lastName,
@zzarcon
zzarcon / kakapo.js
Created June 19, 2016 12:59
Kakapo basic example
import {Database, Router, Server} from 'Kakapo';
const db = new Database();
db.register('user', () => {
firstName: 'Hector',
lastName: 'Zarco'
});
db.create('user', 10);
for (let a of elements) {
console.log(a.getAttribute('href'))
}
NodeList.prototype.forEach = Array.prototype.forEach;
for (var a of elements) {
console.log(a.getAttribute('href'))
}