This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Text.ParserCombinators.Parsec | |
import Data.List | |
type Args = [String] | |
type Body = [String] | |
type Label = String | |
data JSONProp = JSONProp Label JSON deriving Show | |
data JSON = JSONObject [JSONProp] | |
| JSONNumber Double |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
Zachary Weaver <[email protected]> | |
JSONParser.hs | |
Version 0.1.1 | |
A simple example of parsing JSON with Parsec in haskell. Note that | |
since the primary point of this excersize is demonstration, | |
Text.Parsec.Token was avoided to expose more of the grammar. Also, | |
complicated optimizations and shorcuts were avoided (mostly). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RAF where | |
import Prelude | |
import Data.Foldable (traverse_) | |
import Data.Maybe (Maybe(..)) | |
import Effect.Aff.Class (class MonadAff) | |
import Effect.Ref as Ref | |
import Halogen as H | |
import Halogen.HTML as HH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 MODE 1 | |
110 ORIGIN 320,200 | |
120 GREEN=9:BGREEN=18:BRED=6:BLACK=0 | |
130 INK 1,GREEN:INK 2,BGREEN:INK 3,BRED:INK 4,0 | |
140 DEG | |
150 SW=60:EW=240:ST=10 | |
160 R=190:FC=1 | |
170 GOSUB 300 | |
180 R=175:FC=2 | |
190 GOSUB 300 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% INSTRUCTIONS | |
% =swipl echo-server.pl= | |
% =:- start_server.= | |
% | |
% Then navigate to http://localhost:3000 in your browser | |
:- module(echo_server, | |
[ start_server/0, | |
stop_server/0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cljs.promise | |
(:refer-clojure :exclude [resolve])) | |
(defmacro promise | |
" | |
Example: | |
(promise (resolve 5)) | |
(promise (reject (js/Error. \"oops\"))) | |
" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; load some data up | |
LDA #$7 | |
STA $00 ; memory addr A | |
LDA #$05 | |
STA $01 ; memory addr B | |
JMP Divide | |
;modulus, returns in register A | |
Mod: | |
LDA $00 ; memory addr A |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn create-function-call [param expr] | |
"Create an sexp for calling expr with a first argument provided by a promise. | |
If expr is a list (already in form suitable for a function call), insert the first argument at second position, | |
otherwise turn expr into a function call expression, unless the function is an fn, which is simply returned. | |
println -> (fn [param] (println param)) | |
(* 2) -> (fn [param] (* param 2)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the tool | |
# python detect_color.py --image source.png | |
# | |
# Install the opencv and numpy packages before | |
# python -m pip install numpy | |
# python -m pip install opencv-python | |
# python -m pip install scikit-learn | |
# import the necessary packages | |
import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @typedef MutationCallback | |
* @param {NodeList} addedNodes A NodeList of elements that have been added to the DOM. | |
* @param {NodeList} removedNodes A NodeList of elements that have been removed from the DOM. | |
*/ | |
/** | |
* Add a MutationObserver to a DOM node. | |
* | |
* @example | |
* |