In React's terminology, there are five core types that are important to distinguish:
React Elements
package main | |
import "strconv" | |
import "fmt" | |
type Color string | |
type Make string | |
type Model string | |
const ( |
#!/bin/bash | |
# script: time-docker-build.sh | |
# | |
# All command line arguments are passed to docker build command. | |
# | |
# usage: ./time-docker-build.sh | |
# | |
DATE_FORMAT="+%s" |
const {useCallback, useEffect, useReducer, useRef} = require('react'); | |
let effectCapture = null; | |
exports.useReducerWithEmitEffect = function(reducer, initialArg, init) { | |
let updateCounter = useRef(0); | |
let wrappedReducer = useCallback(function(oldWrappedState, action) { | |
effectCapture = []; | |
try { | |
let newState = reducer(oldWrappedState.state, action.action); |
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type Foo struct { | |
FirstName string `tag_name:"tag 1"` | |
LastName string `tag_name:"tag 2"` |
In React's terminology, there are five core types that are important to distinguish:
React Elements
// Inspired by https://github.com/Munksgaard/session-types | |
interface Chan<Env, Protocol> { | |
env_and_protocol: [Env, Protocol]; | |
} | |
class Eps implements HasDual { | |
readonly tag: 'Eps' = 'Eps'; | |
readonly dual!: Eps; | |
} |
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
func main() { | |
r := genericMap([]int{1, 2, 3, 4}, func(x int) string { | |
return "Hello" |
var Benchmark = require('benchmark'); | |
Benchmark.prototype.setup = function() { | |
a = ["test"]; | |
for (var i = 0; i < 10000; i++) { | |
a.push("some other stuff"); | |
} | |
s = a.join(); | |
re1 = new RegExp("^test"); | |
re2 = new RegExp("^not there"); | |
}; |
// This is *not* valid Go! | |
func Map(f func(A) B, xs []A) []B { | |
ys := make([]B, len(xs)) | |
for i, x := range xs { | |
ys[i] = f(x) | |
} | |
return ys | |
} | |
Map(func(x int) int { return x * x }, []int{1, 2, 3}) |
resolveURL: function (route, params, appendRoot) { | |
var appendRoot = (appendRoot == false) ? false : true; | |
var route, params; | |
var href = ""; | |
var regExpAllNormalParams = /(\(\?)?\/:\w+/g; | |
var regExpAllOptionalParams = /\((.*?)\)/g; | |
href = router.routes[route]; |