This file contains 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 React, { Context, useContext } from 'react' | |
export interface IEntityProviderProps<EntityType> { | |
children: React.ReactNode | |
context: Context<ValueType<EntityType>> | |
entity: EntityType | undefined | |
} | |
type ValueType<EntityType> = { initialized: true; entity: EntityType } | { initialized: false } |
This file contains 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 * as fs from 'fs' | |
import * as pathModule from 'path' | |
import { Dir, DirItem, Root, File } from './file' | |
interface IResNode { | |
[key: string]: IResNode | string | |
} | |
const OUTPUT_JSON = './src/utils/settings.json' |
This file contains 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
virtual_node_context = | |
nodes_map: new WeakMap | |
class StringNode | |
constructor: (@parent, @string)-> | |
@context =@parent .context | |
try_render: ( container )-> | |
el =$ '<div>' | |
el .append @string | |
@contents =el .contents() |
This file contains 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
//deno run -A runner.js t.coffee | |
import * as cs from 'https://coffeescript.org/v2/browser-compiler-modern/coffeescript.js' | |
let f = async ()=>{ | |
const decoder = new TextDecoder('utf-8'); | |
var content = await Deno.readFile( Deno.args[0] ); | |
const source = decoder.decode(content); | |
let js = cs.compile( source ); | |
eval( js ); |
This file contains 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
entity ={} | |
entity .prototype =entity | |
entity .base_create =( proto )-> #props? | |
res =Object .create proto | |
res .entity =entity | |
res | |
schema_prototype = | |
get_prototype: ->@_prototype | |
process: ( entity_schema )-> |
This file contains 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
modules ={} | |
for id in 'fs path vm coffeescript' .split ' ' | |
modules[ id ] =require id | |
exports = | |
read: ( file )-> | |
unless file[ 0 ] =='/' | |
file =modules .path .join( __dirname, file ) | |
modules .fs .readFileSync file, 'utf8' | |
compile: ( coffee, file )-> |
This file contains 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
require 'awesome_print' | |
require 'pathname' | |
require 'net/ssh' | |
require 'net/scp' | |
class SFile | |
attr_reader :sym, :base, :root, :path | |
def initialize( sync, parent, path_str ) | |
@root =parent ? parent .root : self | |
@sync =sync |
This file contains 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
require 'awesome_print' | |
class Item | |
attr_reader :code, :name | |
def initialize( code, name ) | |
@code, @name = code, name | |
end | |
def to_s | |
"#{ @code } #{ @name }" | |
end | |
end |
This file contains 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
require 'awesome_print' | |
require 'fileutils' | |
require 'time' | |
class Option | |
attr_reader :name, :underscore, :index | |
attr_accessor :named_value | |
def initialize( name =nil, underscore =false, index =false, to_sql =nil ) | |
@name, @underscore, @index, @to_sql =name, underscore, index, to_sql | |
@named_value =to_sql != nil |
This file contains 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
#dumb perms string to int | |
def process_perm | |
r ='' | |
n =0 | |
n +=4 if @perms[ 1 ] =='r' | |
n +=2 if @perms[ 2 ] =='w' | |
n +=1 if @perms[ 3 ] =='x' | |
r +=n .to_s | |
n =0 | |
n +=4 if @perms[ 4 ] =='r' |