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
| type 'a tree = | |
| | Leaf | |
| | Node of 'a * 'a tree * 'a tree | |
| let node_of_tx tx = if String.length tx > 0 then Node (tx, Leaf, Leaf) else Leaf | |
| let tree_of_txs txs = | |
| let nodes = List.map node_of_tx txs in | |
| match nodes with | |
| | [] -> Leaf |
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
| type socket | |
| type event | |
| type config = { | |
| reconnect: bool; | |
| debug: bool; | |
| timeout: int; | |
| interval: int | |
| } |
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 strict'; | |
| class Node { | |
| constructor(data) { | |
| this.data = data; | |
| this.left = undefined; | |
| this.right = undefined; | |
| } |
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
| function search(dst, arr) { | |
| // sort the input array | |
| arr.sort((a, b) => a-b); | |
| // if array is reduced to a member and still no match, return false | |
| if ((arr.length == 1) && (arr[0] !== dst)) | |
| return false; | |
| // define a middlebound |
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
| package main | |
| import ( | |
| "log" | |
| "strings" | |
| ) | |
| type Session struct { | |
| Email string | |
| Password string |
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
| package main | |
| import "fmt" | |
| type List struct { | |
| Inner []int | |
| } | |
| func NewList(s []int) List { | |
| return List{Inner: s} |
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
| /* Database server */ | |
| package main | |
| import ( | |
| "fmt" | |
| "html" | |
| "log" | |
| "net/http" | |
| "net/url" |
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
| #include <Process.h> | |
| Process date; // process used to get the date | |
| int dates, month, years, hours, minutes, seconds; // for the results | |
| int lastSecond = -1; // need an impossible value for comparison | |
| void setup() { | |
| Bridge.begin(); // initialize Bridge | |
| Serial.begin(9600); // initialize serial |
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
| package di | |
| import ( | |
| "fmt" | |
| "regexp" | |
| ) | |
| // This is a pretty dumb function. It can only works | |
| // if you want to stay with "Hello" forever. | |
| func PrintIfMatchedHello(msg string) { |