Skip to content

Instantly share code, notes, and snippets.

View jenya239's full-sized avatar

Evgeniy Arshanskiy jenya239

View GitHub Profile
@jenya239
jenya239 / .coffee
Last active September 22, 2020 15:28
virtual node
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()
@jenya239
jenya239 / runner.js
Created June 2, 2020 23:27
deno run coffeescript ))
//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 );
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 )->
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 )->
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
@jenya239
jenya239 / test.rb
Last active May 14, 2019 17:01
instat test
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
@jenya239
jenya239 / sql.rb
Last active May 11, 2019 18:11
sql.rb
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
@jenya239
jenya239 / .rb
Created April 18, 2019 13:19
ruby ftp
#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'
@jenya239
jenya239 / rbenv.sh
Last active October 29, 2019 12:52
rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec bash
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
rbenv install 2.6.4
rbenv global 2.6.4
@jenya239
jenya239 / convert_js.coffee
Created September 6, 2018 12:46
simple semi es6 to coffee2
fs =require 'fs'
path =require 'path'
coffeelint =require 'coffeelint'
debug =console .log
file =process .argv[ 2 ]
content =fs .readFileSync file, 'utf8'
# $$ Inserts a "$".
# $& Inserts the matched substring.
# $` Inserts the portion of the string that precedes the matched substring.
# $' Inserts the portion of the string that follows the matched substring.