Skip to content

Instantly share code, notes, and snippets.

View salomvary's full-sized avatar

Márton Salomváry salomvary

View GitHub Profile
@salomvary
salomvary / apply.bind.js
Last active August 29, 2015 13:57
Finally found a reason to use Function.prototype.apply.bind
test(function() {
[
['foo', 'bar', 'baz'],
['fuz', 'barz', 'bazz'],
['fux', 'bax', 'bazx']
].forEach(Function.apply.bind(function(input1, input2, expectedOutput) {
assertEquals(subject(input1, input2), expectedOutput)
}, this))
})
// Yes, I know there are other (less cryptic) ways to achieve this :)
@salomvary
salomvary / alphabet.markdown
Last active August 29, 2015 14:05
Bulgarian
Name Description
Help Display the help window.
Close Closes a window
Letter Pronounciation
А а А а a in father
Б б Б б b in bat
В в В в v in van
@salomvary
salomvary / gist:aa16564410e8d1fad7e4
Created November 12, 2014 09:18
Scala type ascription
scala> class Foo
defined class Foo
scala> class Bar extends Foo
defined class Bar
scala> new Foo
res6: Foo = Foo@3ace5360
scala> new Bar
ngrep -d tap0 -W byline port 80
@salomvary
salomvary / Scala❤Java❤JavaScript.scala
Created November 26, 2014 22:00
Scala❤Java❤JavaScript
/**
* Usage:
* scalac Main.scala
* scala com.example.Main
*/
package com.example
import java.util.function.Function
import javax.script.ScriptEngineManager
@salomvary
salomvary / settimeout-nashorn.js
Created November 27, 2014 17:55
setTimeout for Nashorn
// Adopted from here: https://gist.github.com/bripkens/8597903
// Makes ES7 Promises polyfill work on Nashorn https://github.com/jakearchibald/es6-promise
// (Haven't verified how correct it is, use with care)
(function(context) {
'use strict';
var Timer = Java.type('java.util.Timer');
var Phaser = Java.type('java.util.concurrent.Phaser');
var timer = new Timer('jsEventLoop', false);
@salomvary
salomvary / rest-idl.md
Created December 11, 2014 12:07
REST IDL
@salomvary
salomvary / add-all.sh
Created December 16, 2014 17:55
Add all jvms to jenv on Mac
#!/bin/bash
/usr/libexec/java_home -V 2>&1 1>/dev/null |
tail -n +2 |
awk -F $'\t' '{ print $3 }' |
xargs -n 1 jenv add
Process: SoundCleod [31653]
Path: /Applications/SoundCleod.app/Contents/MacOS/SoundCleod
Identifier: sc.SoundCleod
Version: 0.17 (0.17)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: SoundCleod [31653]
User ID: 502
Date/Time: 2015-01-12 11:35:35.447 -0500