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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Index</title> | |
| </head> | |
| <body> | |
| <div id="ROOT"></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
| #chokidar "*.nim" -c "nim js -r test.nim" | |
| import patty | |
| import jsconsole | |
| import jsffi | |
| import zero_functional | |
| import templates | |
| type | |
| Html* = object | |
| title*: cstring |
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 strutils | |
| type | |
| Dispatch = enum | |
| Reveal | |
| IKind = enum | |
| Human, NonHuman | |
| ObIkind = ref object of RootObj | |
| kind*: IKind | |
| Person = object of ObIkind |
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
| npm install -g chokidar-cli | |
| nim c --run <name_of_entry>.nim | |
| chokidar '*.nim' -c 'killall -9 <name_of_entry>; nim c --run <name_of_entry>.nim' |
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
| const eventManager = (listeners, app={}) => (eventData, listener) => { | |
| try { | |
| listeners[listener](eventData, app); | |
| } | |
| catch(e) { | |
| console.trace(e); | |
| } | |
| } | |
| const toggle = classElement => { |
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
| /** | |
| mixins: [ | |
| Router(view) | |
| ], | |
| */ | |
| export function Router(appView) { | |
| return function router(emit, view) { | |
| return { | |
| state: { | |
| router: match(location.pathname) |
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
| const copy = obj => | |
| JSON.parse(JSON.stringify(obj)); | |
| export const app (obj) => { | |
| let state = copy(obj.state); | |
| const actions = {}; | |
| Object.keys(obj.actions).forEach(action => { | |
| const actionWrapper = (...params) => { | |
| if(Array.isArray(params)) { | |
| params = copy(params); |
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 stringinterpolation | |
| import sequtils | |
| type | |
| Link = tuple[name: string, url: string] | |
| Links = seq[Link] | |
| State = tuple[title: string, links: Links] | |
| proc join(items: seq[string]): string = | |
| result = "" |
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
| (.//span[@class='categoryCount' and text()="1"])[1] |