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
class Bar { | |
constructor(public foo: Foo) {} | |
} | |
class Foo { | |
private cachedBar: Bar | null = null; | |
getBar() { | |
if (this.cachedBar !== null) return this.cachedBar; | |
this.cachedBar = new Bar(this); |
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
CONSTANTS | |
ClientIds = {c1, c2} | |
ObjectIds = {o1, o2} | |
PropNames = {p1, p2} | |
Values = {v1, v2, v3} | |
NULL = NULL | |
MaxWrites = 3 | |
MaxNetworkFailures = 2 | |
SPECIFICATION Spec |
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
// An example of integrating global state with React. | |
// Not necessarily recommended for production applications. | |
import { useSyncExternalStore } from "react"; | |
// Define the application's state as a global variable | |
type State = { counter: number }; | |
let state: State = { counter: 0 }; | |
// React needs to know when the state changes so it knows when |
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
{ | |
"components": { | |
"schemas": { | |
"example": { | |
"required": [ | |
"example", | |
"example3" | |
], | |
"type": "object", | |
"properties": { |
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 Main | |
import Data.Vect | |
import Data.Fin | |
%default total | |
find : Eq x => List x -> x -> Maybe Int | |
find [] elem = Nothing | |
find (y :: xs) elem = if y == elem then (Just 0) else (map (\ n => n + 1) (find xs elem)) |
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
-- So as an example of using a log orientated approach in PostgreSQL, | |
-- let's write a simple blog application. We will want to be able to: | |
-- * Write and edit blog posts | |
-- * Publish revisions of posts for public viewing | |
-- * Delete posts | |
-- * Add or remove tags to posts | |
-- Let's start by creating a schema. |
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
use std::env::args; | |
use std::io::{Error, Read}; | |
use std::fs::File; | |
fn run(filename : &str) -> Result<(), Error> { | |
let mut f = try!(File::open(filename)); | |
let mut s = String::new(); | |
try!(f.read_to_string(&mut s)); | |
println!("{}", s); | |
return Ok(()); |
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
fn main() { | |
let mut arglist = args().skip(1); | |
match arglist.next() { | |
Some(ref filename) if arglist.count() == 0 => run(filename), | |
_ => usage() | |
} | |
} |
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
(def-alias Zipper | |
(HMap :mandatory {:focus (U nil Node) :left (Vec Node) :right (Vec Node) :path Path :counter Integer} | |
:complete? true)) | |
(ann left [Zipper -> Zipper]) | |
(defn left [zipper] | |
(let [prev (peek (:left zipper))] | |
(if (nil? prev) | |
zipper | |
{:focus prev |
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
input { | |
lumberjack { | |
'port' => '5005' | |
'ssl_certificate' => '/opt/logstash/certs/lumberjack.cert' | |
'ssl_key' => '/opt/logstash/certs/lumberjack.key' | |
'ssl_key_passphrase' => 'testing' | |
'type' => 'gocardless' | |
} | |
} |