Skip to content

Instantly share code, notes, and snippets.

View kulicuu's full-sized avatar

J Wylie Кулик kulicuu

View GitHub Profile
@kulicuu
kulicuu / gist:6750178
Last active December 24, 2015 05:19
permute a string
_ = require 'underscore'
c = console.log
mia = ['a', 'b', 'c', 'd']
# or
miString = 'abcd'
mia = miString.split("")
# you can put any string you like, then call the recursive routine below:
permute = (a) ->
c 'permute and mia ', a
if a.length == 1
@kulicuu
kulicuu / SocketStreamExpress.iced
Last active August 29, 2015 14:00
essential elements of a SocketStream main app file that integrates Express within the Ss stack:
http= require 'http'
ss= require 'socketstream'
express= require 'express'
metro= express()
connectRedis= require 'connect-redis'
redisStore= connectRedis express
metro.use express.json()
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@kulicuu
kulicuu / hebrew dvorak phonetic keboard map
Last active October 13, 2018 09:04
hebrew dvorak phonetic keyboard mapping for ubuntu linux, (/usr/share/X11/xkb/symbols/il)
// dvorak-phonetic
partial alphanumeric_keys
xkb_symbols "dvorak" {
name[Group1]= "Hebrew (dvorak)";
key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] };
key <AE01> { [ 1, exclam ] };
key <AE02> { [ 2, at ] };
@kulicuu
kulicuu / dvorak_russian.md
Last active June 5, 2016 15:29
dvorak russian keyboard layout

' " , <

. >

p P ::: П п :::: u+041f

y Y ::: Уу ::: u

@kulicuu
kulicuu / another.coffee
Last active August 29, 2015 14:08
translate arabic to roman numerals :: the boring and un-elegant way
c= console.log
c "another arabic to roman numeral translator: \n"
digitiser= (integra)->
if integra >= 10000 then c "error, we're only taking numbers less than 10,000"
strang= integra.toString()
rayy= strang.split ''
arq= {}
switch strang.length
when 4
@kulicuu
kulicuu / oct29.iced
Last active August 29, 2015 14:08
array manipulation exercises
# some array exercises around the codility exercise
c= console.log
# functions:
# 0- check if order is non decreasing
# 1- check if array can be made non-decreasing with just one swap. (or less)
# 2- getAll repeated element substrings (one black sheep allowed). this may not be helpful for finding (1), but it's a good exercise in itself
# possible algos approaches for finding (1)
# - if array small then could just go through all combos blindly and check if order is good. slightly better to only go through those swaps which transfer large to back of array and small to front.
@kulicuu
kulicuu / jan2_request.coffee
Last active August 29, 2015 14:12
life's simple pleasures
# jan2 request bluebird stuff
c= console.log
_= require 'lodash'
Promise= require 'bluebird'
rp= require 'request-promise'
qStr= require 'querystring'
parse_quals= (quals)->
return _.reduce quals,
(acc0, value, key)->
@kulicuu
kulicuu / stringhandler2.java
Created May 19, 2015 06:41
permutation thing in java did this some years ago
/**
* This
*/
import java.util.*;
public class StringHandler2{
//public ArrayList<String> arrayPurms = new ArrayList<String>();
public static ArrayList<String> SetPermute(HashSet <String> resultSet){
System.out.println("We're in SetPermute. With argument " + resultSet.toString());
ArrayList <String> arrayPurms = new ArrayList <String> ();
if (resultSet.size() == 1) {
#----------------------------------------------
# monkey patch, original from
# https://gist.github.com/akre54/80eaa63762ea499029f0
# this one edited
# this one works with React version 0.14.0-beta1 but NOT work with 0.14.3.
# no other versions tested
c = -> console.log.apply console, arguments
ReactDOM = require 'react/lib/ReactDOM'