I hereby claim:
- I am donut on github.
- I am donut2d (https://keybase.io/donut2d) on keybase.
- I have a public key ASC7Ca_uC20tY6gxRMv5jLjQq4AirMKa-6bHWB6W-kXPXgo
To claim this, I am signing this object:
###* | |
* @file | |
* Provides mixin support for classes. | |
* @url https://gist.github.com/donut/00e407abb7cece0bcdfa | |
* @see http://coffeescriptcookbook.com/chapters/classes_and_objects/mixins | |
### | |
module.exports = (base, mixins...) -> | |
constructors = [] |
###* | |
* @file | |
* Provides support for classes to have event systems. | |
* @url https://gist.github.com/donut/e4268b600bf72a8290e8 | |
### | |
class EventsMixin | |
constructor: -> | |
@_event_handlers = {} |
import Foundation | |
extension Dictionary { | |
func mapValues<T>(transform: Value->T) -> Dictionary<Key,T> { | |
// Adapted from http://stackoverflow.com/a/29460871/134014 | |
var dict = [Key:T]() | |
for (key, value) in zip(self.keys, self.values.map(transform)) { | |
dict[key] = value | |
} |
I hereby claim:
To claim this, I am signing this object:
(jbuild_version 1) | |
(executable | |
((name main) | |
(libraries (core cohttp.lwt mariadb)))) |
#load "unix.cma";; | |
open Printf;; | |
let by_string x = | |
x |> string_of_int |> String.length | |
;; | |
let rec by_recursion = function | |
| 0 -> 1 | |
| x -> 1 + by_recursion (x / 10) |
From:
https://reknew.org/2018/08/part-8-of-15-race-and-social-hierarchies/
Well, “back in the day” we had three television Networks, and it was in the interest of all of them to report the News with as little bias as possible to attract the widest possible audience. With the advent of Cable News, however, people are able to watch the filtered version of the News that they agree with and that therefore activates the pleasure centers of their brain. And when liberal and conservative minded people no longer have to try to see the world through each other’s eyes, they get hardened in their perspectives. In time, they lose the willingness, and then the ability, to understand the perspectives of those who fundamentally disagree with their deeply held beliefs. Those who oppose them, therefore, can’t possibly be doing so on rational or moral grounds, which means they must either be stupid or immoral. They therefore cannot be reasoned with. They must simply be defeated.
If someone has a practical solution as to
let use_reducer ?(middleware=[]) reducer initial = | |
(* [middlewared_dispatch] is setup as a reference so we can change it to the | |
dispatch function returned by [useReducer]. This way we can insert | |
middleware before the real reducer function runs. *) | |
let middlewared_dispatch = React.useRef (fun a -> | |
Js.Console.error2 "Dispatch called before reducer hook initialized." a) | |
in | |
let apply_middleware middleware state action = | |
let dispatch = React.Ref.current middlewared_dispatch in |
type ('action, 'state) middleware | |
= dispatch:('action -> unit) | |
-> 'state | |
-> 'action | |
-> [ `Rerun of 'action | `Next of 'action | `Stop of 'action ] | |
let apply_middleware middleware dispatch state action = | |
let rec apply action = function |