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
<html> | |
<head> | |
<script defer src=https://cdn.jsdelivr.net/npm/p5></script> | |
<script defer src=https://cdn.jsdelivr.net/npm/p5/lib/addons/p5.dom.min.js></script> | |
<script defer src=https://cdn.jsdelivr.net/npm/p5/lib/addons/p5.sound.min.js></script> | |
<script src="js/lib/toxiclibs.js"></script> | |
<script src="vector.js"></script> | |
<!-- Select which file to run --> |
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
{ | |
"presets": ["@babel/preset-react", "@babel/preset-env"] | |
} |
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 axios from 'axios' | |
import cache from '../utils/cache' | |
export function get(slug) { | |
const url = `${process.env.GILBERT_URL}/api/v1/content/pages/${slug}` | |
const call = axios.get(url) | |
return cache({ | |
key: slug, | |
exp: 120, |
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
other pane cx o | |
close pane cx 0 | |
go to end of line ce | |
go to start of line ca | |
go to end of file m> | |
go to start of file m< | |
go to forward word mf | |
go to back word mb |
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
# EMI::ICPConnectionDataClient.new.find(id) | |
module EMI | |
class ICPConnectionDataClient | |
include HTTParty | |
class ICP < OpenStruct; end; | |
base_uri 'https://emi.azure-api.net/ICPConnectionData' |
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 icp-api.core | |
(:require [org.httpkit.server :as s] | |
[clojure.data.json :as json] | |
[clj-http.client :as client] | |
[inflections.core :as i])) | |
(def api-key "XXXXXXXXXXXXXXXXXXXXX") | |
(def uri "https://emi.azure-api.net/ICPConnectionData/single") | |
(defn- get-icp |
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
;; Objective ; print out x rows of pascals trianlge | |
;; https://www.mathsisfun.com/pascals-triangle.html | |
;; (factorial 4) => 4 * 3 * 2 * 1 = 24 | |
(defn factorial [n] | |
(reduce * (range 1 (inc n)))) | |
;; (binomial-coefficient n k) => n! / k!(n-k)! | |
;; | |
;; (binomial-coefficient 4 2) => 24 / 2 * 2 => 24 / 4 => 6 |
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
(def puzzle [ 3 0 0 0 0 5 0 1 0 | |
0 7 0 0 0 6 0 3 0 | |
1 0 0 0 9 0 0 0 0 | |
7 0 8 0 0 0 0 9 0 | |
9 0 0 4 0 8 0 0 2 | |
0 6 0 0 0 0 5 0 1 | |
0 0 0 0 4 0 0 0 6 | |
0 4 0 7 0 0 0 2 0 | |
0 2 0 6 0 0 0 0 3 ]) |
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 bank-account) | |
(defn open-account [] | |
(atom 0) | |
) | |
(defn close-account [account] | |
(reset! account nil) | |
) |
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
# Example of concurrency issue: | |
class Account | |
attr_accessor :amount | |
def initialize | |
@amount = 0 | |
end | |
def get_balance |
NewerOlder