(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /* | |
| * object.watch polyfill | |
| * | |
| * 2012-04-03 | |
| * | |
| * By Eli Grey, http://eligrey.com | |
| * Public Domain. | |
| * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
| */ |
| /** | |
| * An implementation for Quicksort. Doesn't | |
| * perform as well as the native Array.sort | |
| * and also runs the risk of a stack overflow | |
| * | |
| * Tests with: | |
| * | |
| * var array = []; | |
| * for(var i = 0; i < 20; i++) { | |
| * array.push(Math.round(Math.random() * 100)); |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| .scrollbox { | |
| overflow: auto; | |
| width: 200px; | |
| max-height: 200px; | |
| margin: 50px auto; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/usr/bin/env python3 | |
| # | |
| # This is a simple script to encrypt a message using AES | |
| # with CBC mode in Python 3. | |
| # Before running it, you must install pycryptodome: | |
| # | |
| # $ python -m pip install PyCryptodome | |
| # | |
| # Author.: José Lopes | |
| # Date...: 2019-06-14 |
| function transformOrigin(matrix, origin) { | |
| const { x, y, z } = origin; | |
| const translate = MatrixMath.createIdentityMatrix(); | |
| MatrixMath.reuseTranslate3dCommand(translate, x, y, z); | |
| MatrixMath.multiplyInto(matrix, translate, matrix); | |
| const untranslate = MatrixMath.createIdentityMatrix(); | |
| MatrixMath.reuseTranslate3dCommand(untranslate, -x, -y, -z); | |
| MatrixMath.multiplyInto(matrix, matrix, untranslate); |
| import okhttp3.Call | |
| import okhttp3.Callback | |
| import okhttp3.Response | |
| import java.io.IOException | |
| import java.util.concurrent.CompletableFuture | |
| fun Call.executeAsync(): CompletableFuture<Response> { | |
| val future = CompletableFuture<Response>() | |
| enqueue(object : Callback { | |
| override fun onResponse(call: Call, response: Response) { |
| brew install libfaketime --build-from-source | |
| # usage | |
| faketime -f "@2020-01-01 00:00:00" node app.js |
| module Bogosort where | |
| import Control.Monad.Primitive | |
| import Control.Monad.ST | |
| import Control.Monad.ST.Unsafe | |
| import Control.Monad.Trans.State.Strict | |
| import Data.Monoid | |
| import qualified Data.Vector as V | |
| import qualified Data.Vector.Generic.Mutable as VGM | |
| import Data.Vector.Generic.Mutable (MVector) |
| import { useEffect, useRef } from 'react'; | |
| export const useEventEmitter = (eventEmitter, eventName: string, fn: () => void) => { | |
| const subscription = useRef(null); | |
| useEffect(() => { | |
| subscription.current = eventEmitter.addListener(eventName, fn); | |
| return () => { | |
| if (subscription.current) { |