Skip to content

Instantly share code, notes, and snippets.

@uchcode
uchcode / counter.hyperapp.html
Last active February 13, 2019 19:40
hyperapp web components
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=2">
<meta name="apple-mobile-web-app-capable" content="yes">
<style>body{margin:0;padding:0;}</style>
<script type="module">
document.addEventListener('touchmove',e=>e.preventDefault(),{passive:false})
import { h, app } from 'https://unpkg.com/hyperapp?module'
const state = {
@uchcode
uchcode / currency-converter.html
Last active January 18, 2019 00:13
Web components + superfine
<title>Currency Coverter</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module">
import { h, patch } from 'https://unpkg.com/superfine?module'
//import { h, patch } from './superfine.js'
const Numberbox = self => ({
type: 'number',
@uchcode
uchcode / currency-converter.html
Created January 17, 2019 10:28
Web components + superfine
<title>Currency Coverter</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module">
import { h, patch } from 'https://unpkg.com/superfine?module'
const Numberbox = self => ({
type: 'number',
value: self.dataCount,
@uchcode
uchcode / HelloSpriteKit.swift
Created November 4, 2018 21:42
Hello SpriteKit
import SpriteKit
import PlaygroundSupport
class Square: SKShapeNode {
convenience init(position: CGPoint = .zero, oneSide: CGFloat = 0.0, strokeColor: SKColor = .white) {
let c = CGFloat(oneSide * 0.2)
let r = CGSize(width: oneSide, height: oneSide)
self.init(rectOf: r, cornerRadius: c)
self.position = position
self.strokeColor = strokeColor
@uchcode
uchcode / script.js
Last active July 12, 2018 01:21
Superfineの管理と部品化のサンプルコード ref: https://qiita.com/tom-u/items/08f8b1dd2cf5303a193e
import * as superfine from 'https://unpkg.com/superfine?module';
export class SuperfineManager {
constructor(container, template) {
this.container = container;
this.template = template;
this.node = null;
this.update = null;
}
setup(node) {
@uchcode
uchcode / app.js
Last active July 9, 2018 10:25
Superfineを使用したMVCの例 ref: https://qiita.com/tom-u/items/5fef560a906e105fdaa5
import { h } from './fineapple.js';
import * as Counter from './counter.js';
const app = new Counter.Controllers(new Counter.Model(), document.body, app =>
h('div', {}, [
h('h1', {}, 'Fineapple: for building web app.'),
h('div', {class:'counter'}, [
h('h2', {}, app.model.count),
h('button', { onclick: () => app.sub().info('sub',app.model) }, '-'),
@uchcode
uchcode / counter.js
Last active July 9, 2018 00:30
Superfine + class = SuperfineApp ref: https://qiita.com/tom-u/items/a2d7602d02320d1625d8
// import * as superfine from 'https://unpkg.com/superfine?module'
// const { h } = superfine;
//
// const view = count =>
// h('div', {}, [
// h('h1', {}, count),
// h('button', { onclick: () => render(count - 1) }, '-'),
// h('button', { onclick: () => render(count + 1) }, '+')
// ])
//
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ultrapp</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module">
import * as superfine from 'https://unpkg.com/superfine?module'
@uchcode
uchcode / hello-vdom.html
Last active July 1, 2018 22:44
vdom().tag('h1', {}, 'hello vdom').toBody() ref: https://qiita.com/tom-u/items/6ab460cc9d9b12cbb4eb
<!DOCTYPE html>
<html lang="en">
<head>
<title>Counter</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@uchcode
uchcode / properties-and-methods.md
Created June 11, 2018 12:35
properties and methods
const propertynames = Object.keys(this)
const methodnames = Object.getOwnPropertyNames(Object.getPrototypeOf(this))