Skip to content

Instantly share code, notes, and snippets.

Adam Peresztegi flash42

Block or report user

Report or block flash42

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@flash42
flash42 / IntersectionType.java
Created Sep 26, 2019
Use intersection type and method overloading to create type-safe collection initializer
View IntersectionType.java
import java.util.List;
import java.util.ArrayList;
// Demonstrate the usage of intersection types in Java
// We have a quite minimal setup so most of our types are created as inner classes
// Goal:
// We want to store items in two separate lists. These lists are filled by our clients calling the `addItem` method
// Our clients don't know about the implementation (two lists) and we don't want to use `instanceof`.
public class IntersectionType {
@flash42
flash42 / install-haxe.sh
Last active Jul 4, 2018
Installer for haxe 3.1.3
View install-haxe.sh
#!/bin/sh
# Copied from: https://gist.github.com/jgranick/8cc40e2e0f277146725f
HAXE_VERSION=3.1.3
NEKO_VERSION=2.0.0
if [ `uname -m` = "armv7l" ]; then
View gist:ac5693e3a96e7c5d90a90726925f8897
http://10.0.0.249:9081/integration_test_worker.html?grep=Arrow%20and%20line%20properties.Can%20increase%20arrow%20thickness
@flash42
flash42 / Bacon_polling_and_errors.md
Last active Aug 29, 2015
Can we find a better way for shutting down polling and throwing errors in Bacon.js?
View Bacon_polling_and_errors.md
Unsubscribe from polling with ugly unsubBus

I've implemented polling with unsubBus "pattern". Can you suggest something better? Pseudo code:

var unsubBus = new Bacon.Bus();
// Poll job status code until it's successful
var succStream = Bacon.interval(pollInterval)
    .takeUntil(unsubBus)
    .flatMapLatest(function (v) { return this.checkStatus(jobId); })
@flash42
flash42 / concatenative_lisp.clj
Created Jul 27, 2014
Comments for elvish documentation Appendix A
View concatenative_lisp.clj
(require ['clojure.string :refer '(upper-case)])
;; In Clojure there is a good vector type for storing strings
(def strs ["aha" "LOLaha" "hahaLOL" "hum?"])
;; One can write it in clojure with the concatenative form as well
;; http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E
(->> strs (filter #(re-find #"LOL" %)) (map upper-case) sort)
@flash42
flash42 / list_registered_handler
Created Jan 18, 2014
list handler registered for dom element event
View list_registered_handler
jQuery._data(document.getElementsByClassName('eval')[0], "events" ).click[0].handler;
You can’t perform that action at this time.