Skip to content

Instantly share code, notes, and snippets.

View jenya239's full-sized avatar

Evgeniy Arshanskiy jenya239

View GitHub Profile
@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.
@jenya239
jenya239 / database.coffee
Created June 17, 2018 21:01
node.js database request promise
exports .DbRequest =class DbRequest
constructor: ( @_sql, @_params =[] )->
@_db =Database .instance
@_binded_db =@_db_handler .bind @
@_promise =new Promise @_promise_hanlder .bind @
_promise_hanlder: ( @_resolve, @_reject )->
@_db .query @_sql, @_params, @_binded_db
_db_handler: (@_error, @rows, @fields )->
@result =@rows
@_resolve @
@jenya239
jenya239 / server.coffee
Created April 7, 2018 06:04
node http serve static
require 'coffeescript/register'
http =require 'http'
utils =require './utils'
path_module =require 'path'
url_module =require 'url'
path_is_inside =require 'path-is-inside'
file_system =require 'fs'
mime =require 'mime-types'
debug =console .log
@jenya239
jenya239 / expander.coffee
Created April 2, 2018 13:58
component schema expander
class Expander
@_instance: null
constructor: ->
throw 'expander exists' if @constructor._instance
@constructor._instance =@
@instance: ->
new @() unless @._instance
@._instance
_name: null
@jenya239
jenya239 / drag_drop.coffee
Created April 1, 2018 10:42
rows drag and drop
class DragDrop
_container: null
_row: null
constructor: (@container ) ->
@_rows_array()
for row, i in @_rows
row .data 'index', i
selector ='.' +namespace.css_classes[ 'row' ]
selector +=' .' +namespace.css_classes[ 'handle' ]
@container.on 'mousedown', selector, @handler 'mouse_down'
@jenya239
jenya239 / compile_scripts.rb
Last active March 24, 2018 16:41
compile coffee scripts ruby
require 'erb'
class Script
@@erb
@@context
def self.init
create_template
create_context end
private
def self.create_template
@jenya239
jenya239 / compile.sh
Last active March 20, 2018 15:59
stylus postcss
stylus test.styl -p | postcss --no-map
#stylus --use stylus-css-modules --with "{}" --use poststylus --with "['postcss-cssnext','lost',require('postcss-functions')({functions:{tf:function(a){return '=='+a;}}}), 'postcss-jsmath']" test.styl -o test.css
@jenya239
jenya239 / out.rb
Last active May 13, 2019 16:35
gtk out listen
#!/usr/bin/env ruby
require "gtk3"
require 'pathname'
require 'awesome_print'
require 'listen'
class Out
def initialize args
create_window
@jenya239
jenya239 / render_slm.coffee
Last active March 22, 2018 14:32
render slm
#!/usr/bin/env coffee
fs =require 'fs'
path =require 'path'
filename ='[stdin]'
object ={}
argv_length =process.argv.length
if argv_length <=2 or process.argv[ 2 ] =='-h'