This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function toIconifyIcon(svg: string): IconifyIcon { | |
| const body = svg.replace(/<svg[^>]*>/, "").replace(/<\/svg>/, ""); | |
| const width = svg.match(/width="(\d+)"/)?.[1]; | |
| const height = svg.match(/height="(\d+)"/)?.[1]; | |
| return { | |
| body: `<g fill="currentColor">${body}</g>`, | |
| width: width ? Number.parseInt(width) : undefined, | |
| height: height ? Number.parseInt(height) : undefined, | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export type ListDiff<T> = | |
| | { type: "insert"; value: T; before?: T } | |
| | { type: "remove"; value: T }; | |
| /** | |
| * Virtual DOM like diff algorhtim for arrays | |
| */ | |
| export function listDiff<T extends { key: string }>( | |
| before: T[], | |
| after: T[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Atom } from 'mobx' | |
| import * as firebase from 'firebase' | |
| // Custom observable for Firebase value | |
| // see https://mobx.js.org/refguide/extending.html | |
| export class FirebaseWatcher<T> { | |
| private atom: Atom | |
| private ref?: firebase.database.Reference | |
| private _value: T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="todo-list"> | |
| <div class="todo"> | |
| <input type="checkbox" class="done"> | |
| <h3 class="title">Title</h3> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import assert from "power-assert"; | |
| import tapSpec from "tap-spec"; | |
| const test = new Test(); | |
| const {describe, it} = test; | |
| describe("foo", () => { | |
| describe(".bar", () => { | |
| it("fetches bar", async () => { | |
| const result = await foo.bar(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Dir.glob("./**/*.haml").each do |haml| | |
| jade = haml.gsub(/\.haml$/, ".jade") | |
| `haml #{haml} --style ugly | html2jade --donotencode --noemptypipe --bodyless > #{jade}` | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var h = require('virtual-dom/h'); | |
| var diff = require('virtual-dom/diff'); | |
| var patch = require('virtual-dom/patch'); | |
| var createElement = require('virtual-dom/create-element'); | |
| function update() { | |
| var newTree = render(counter); | |
| var patches = diff(tree, newTree); | |
| patch(node, patches); | |
| tree = newTree; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var h, mainLoop, render, viewLoop, viewModel; | |
| mainLoop = require('main-loop'); | |
| h = require('virtual-dom/h'); | |
| viewModel = { | |
| count: 0, | |
| countUp: function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var h = require('virtual-dom/h'); | |
| var diff = require('virtual-dom/diff'); | |
| var patch = require('virtual-dom/patch'); | |
| var createElement = require('virtual-dom/create-element'); | |
| var count = 0; | |
| function countup() { | |
| count += 1; | |
| update(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tbl = table do | |
| :foo | :bar | :baz | |
| 1 | 2 | 3 | |
| 1 | 3 | 5 | |
| end # => [{:foo=>1, :bar=>2, :baz=>3}, {:foo=>1, :bar=>3, :baz=>5}] | |
| tbl2 = table :horizontal do | |
| :foo | 1 | 1 | |
| :bar | 2 | 3 | |
| :baz | 3 | 5 |
NewerOlder