This file contains 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 Performance { | |
external now: unit => float = "performance.now" | |
} | |
module BigInt { | |
type t | |
type op = (t, t) => t | |
;[@mel.send] external toString: t => string = "toString" |
This file contains 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 'util/styles' | |
def log do console.log $1 and $1 | |
class Todo | |
@observable text\string | |
@observable done\boolean | |
tag todos | |
@observable todos\Todo[] = [] |
This file contains 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
const observePosts = () => { | |
const timeline = document.querySelector("[data-testid=primaryColumn]") | |
const observer = new MutationObserver((...args) => | |
observePosts.listen(...args), | |
) | |
observer.observe(timeline, { | |
childList: true, | |
subtree: true, | |
}) | |
return observer |
This file contains 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
// https://rescript-lang.org/try?version=v11.0.0-beta.1&code=ALBWGcA8GEHsDsBmBLA5gCgN4DcCmAncZBALgAIAWAGjIFtYATXcgIgEMBXAF1lra+QBjFgF8AlACgJsAA654ZAFLgJ9BhwA2uMgEEyAXiXgAdDvz42ATwBMqxpu0AlA2Ue42grhK1c6bGc6G6GzmVjT48kz4YgYAfGQhFpYAtLE6xnwy6BHwUWKpjsaJVlJclnJkvoaYyOAAYmzwgpbkAEawsBo0grAc8FzkyP00ArS44OTFlgA8ACL8uMZcsSJSPmRDyFVkNfWNzeSIbBrguN29-eQADCPIYxNkANoAuqveuL4cMgwLLuhquC6dHAqBi+nimAkZDI4AA7ltBAALYGoHZQsgAHzIAGIACqwVCoLRxHbGMkAoG1BpNFpkACEFOMVP2llW0Kx2OgGiEAGs4ujoetRuMXIzheBUul-HJcuh5lxFnwebh0GJJNDoZgyRlGIDzn0BnRdRpjD0DWQANRkACMt3ubLIqzewAiHi4pt4MgQ8i86yV2iCYIh6PWWGZNP1w0qd3GIhoDFqMn4SLBZC+PwVBWMHFObnUggI6E2XEkIY+ZEQsHwfG26D6RwjFZZQbIRb2NLIAH4mx3yPXm1nwFx8ENUFJodM+ENYgKyNMZDONRrpkMZNxZ0uynIAPr6FhI3CCHntSAsMgHo+4Bj6XbU5oiMgIaCIxqoXA37ckvEEom4VIJ8Aky4JEHSXAB6RclznDQ2FaQEIRYO9LEfbg1y4TsWEHYdRwfaYwJguCNEgicwIXWdplabgeAUJ9uSPD8vy5Xl-0TZNEREYiNUhKCNXWGQNA4CwNBcM1+gMfRDGtLsyBYM9WHAFgN148tRO2VTUgASX6JZYAAZWw+Axx46FK2rfh0FUmgAAMmMvBgyAAEkwVSH2FJz+ME44RCs9UoNAucwMorhqM46ZOk4zVxVSTJHHQYV+WM6DkAiqDMFMmt0CUnjhVSeVFjfLhc |
This file contains 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
<script> | |
let isFancy = true | |
let count = 0 | |
let times = [] | |
// ❎ functions need $: to update | |
$: format = (unfancy, fancy) => (isFancy ? fancy : unfancy) | |
</script> | |
<p> |
This file contains 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
export abstract class List<T> { | |
readonly isEmpty: boolean | |
constructor(readonly length: number) { | |
this.isEmpty = !length | |
} | |
*[Symbol.iterator](): Generator<T, void, void> { | |
for (let xs = this as List<T>; xs instanceof NonEmptyList; xs = xs.rest) | |
yield xs.first | |
} | |
} |
This file contains 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
/** | |
* @author jtoland | |
*/ | |
Ext.ux.extendMixin('Ext.ux.layout.AlignLayout', Ext.layout.ContainerLayout, function( $super ) { return { | |
monitorResize:true, | |
parseMargins : function( val ) { | |
if (typeof val == 'string') { return arguments.callee.call(null, val.split(' ')); } |
This file contains 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
(** `Tree` abstracts over differnet kinds of trees *) | |
module Tree = struct | |
(** `BasicType` is what tree implementations provide *) | |
module type BasicType = sig | |
type _ children | |
(* polymorphic variant easier to use in implementations *) | |
type 'a tree = [ `Leaf of 'a | `Branch of 'a children ] | |
val flatten : 'a tree -> 'a list | |
end |