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 /
Created Sep 26, 2019
Use intersection type and method overloading to create type-safe collection initializer
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 /
Last active Jul 4, 2018
Installer for haxe 3.1.3
# Copied from:
if [ `uname -m` = "armv7l" ]; then
View gist:ac5693e3a96e7c5d90a90726925f8897
flash42 /
Last active Aug 29, 2015
Can we find a better way for shutting down polling and throwing errors in Bacon.js?
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)
    .flatMapLatest(function (v) { return this.checkStatus(jobId); })
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
(->> strs (filter #(re-find #"LOL" %)) (map upper-case) sort)
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.