Skip to content

Instantly share code, notes, and snippets.

View flashingpumpkin's full-sized avatar
🏠
Working from home

Alen Mujezinovic flashingpumpkin

🏠
Working from home
View GitHub Profile
@flashingpumpkin
flashingpumpkin / uuid.kt
Created August 3, 2022 15:33 — forked from icedraco/uuid.kt
Kotlin UUID3 and UUID5 tool
/***
* Source:
* https://stackoverflow.com/questions/40230276/how-to-make-a-type-5-uuid-in-java
*/
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException
import java.util.UUID
from decimal import Decimal
from datetime import datetime
import time
from hummingbot.script.script_base import ScriptBase
from hummingbot.core.event.events import BuyOrderCompletedEvent, SellOrderCompletedEvent
from os.path import realpath, join
s_decimal_1 = Decimal("1")
LOGS_PATH = realpath(join(__file__, "../../logs/"))

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@flashingpumpkin
flashingpumpkin / ducky.md
Created January 10, 2020 14:36 — forked from schmich/ducky.md
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@flashingpumpkin
flashingpumpkin / ScalaJsElmExample.scala
Created November 14, 2018 16:54 — forked from Fristi/ScalaJsElmExample.scala
Monifu / Monix / Elm example
import japgolly.scalajs.react.vdom.all._
import japgolly.scalajs.react.{ReactElement, SyntheticEvent}
import monifu.reactive.Observable
import monifu.reactive.subjects.BehaviorSubject
object StateExample {
//---------------------------------
// (VIEW)-MODEL
//---------------------------------
@flashingpumpkin
flashingpumpkin / device.css
Created May 24, 2016 12:51 — forked from jsoverson/device.css
Quick css hacks to target android/ios
.visible-android {
display:none;
}
.visible-ios {
display:none;
}
.on-device .visible-android, .on-device .visible-android {
display:inherit;
}
.device-ios .visible-android {
class Try(object):
"""
Encapsulate an operation potentially throwing an error. A try
instance is `True` if no error was thrown, it's `False` if an
error occured.
"""
def __init__(self, fn):
self.fn = fn
self()

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

abstract class Product
abstract class PizzaBuilder {
var dough: String
var sauce: String
var topping: String
def withDough(dough: String): PizzaBuilder
def withSauce(sauce: String): PizzaBuilder
def withTopping(topping: String): PizzaBuilder
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#