Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am voter101 on github.
  • I am voter101 (https://keybase.io/voter101) on keybase.
  • I have a public key ASA_SMNo8S0qbdNsYE8k999BOB1Vu_cwA2PkQ6QKpv0b5wo

To claim this, I am signing this object:

@voter101
voter101 / flatten.js
Created Aug 3, 2016
Flattening nested arrays in JavaScript
View flatten.js
// Let me present my steps in finding the right solution. If you are not interested in seeing the process,
// please skip to `flatten2` function.
// You can copy-paste the code into your browser - it will run both versions against tests and return output
// First approach, a bit naive, split to 2 functions. Let's do it dirty, but working.
//
// The idea is to use the fact of JavaScript's property of pass-by-reference arguments in function
// This solution is in O(n).
function flatten1(arr) {
View prefixes.ml
let rec prefixes l = match l with
[] -> []
| x::xs -> [x] :: (List.map (fun a -> (x :: a)) (prefixes xs));;
@voter101
voter101 / Gulpfile.js
Last active Jun 20, 2019
Gulpfile for Rails application with replaced Sprockets with Gulp
View Gulpfile.js
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
View gist:a57ef67d84245b1d9d6c
Our file structure per single mini-application:
app_starter.js.coffee
--- app_directory
--- app.module.js.coffee
--- backend.module.js.coffee
--- components
--- component_file1.module.js.coffee
...
--- domain.module.js.coffee
--- glue.module.js.coffee
@voter101
voter101 / 5.asm
Created May 5, 2014
Mips exercise 5 (using Digital Sim Lab in Mars)
View 5.asm
addi $t3, $zero, 4294901776 #right display
addi $t4, $zero, 4294901777 #left display
newGame:
li $v0, 42
li $a1, 255
syscall
move $t7, $a0
addi $t6, $zero, 0
addi $t5, $zero, 7
loop:
@voter101
voter101 / 3.asm
Created May 5, 2014
Mips exercise 3
View 3.asm
main:
addi $t7, $zero, 128
li $v0, 13
la $a0, filename
li $a1, 0
li $a2, 0
syscall
addi $s0, $v0, 0
readFromFile:
@voter101
voter101 / 2.asm
Created May 5, 2014
Mips exercise 2
View 2.asm
li $v0, 7
syscall
mov.d $f6, $f0 # f6 = a
li $v0, 7
syscall
mov.d $f8, $f0 # f8 = e
# setting f2 = x0
# f2 = x_(n-1)
addi $s0, $zero, 2
@voter101
voter101 / 1.asm
Created May 5, 2014
Mips exercise 1
View 1.asm
jal printResult
j main
nextState:
add $t7, $zero, $ra
addi $t6, $zero, 0
addi $t4, $zero, 31
nextStateLoop:
jal countNeighbours
jal checkBit