Instantly share code, notes, and snippets.

View mobx-react.js
import { observable, computed } from 'mobx';
import { observer, Provider} from 'mobx-react';
import * as React from 'react';
import { render} from 'react-dom';
class State {
// hidden/private when outside constructor
@observable _a = 1
@observable b =2
@observable c =3
View python-arguments.pyt
# *arg: nonkeyword argument, takes a tuple or list, **karg: keyworded argument, takes a dictionary
def boo(*arg, **karg):
print(arg)
print(karg)
a = (1,2,3,4)
b = {"name":"Chris", "age":19}
# expand the symbols
boo(*a, **b)
View go-inhetitance.go
package main
import (
"fmt"
)
type moo struct{
id int
foo
}
View go-pass-by-reference.go
package main
import (
"fmt"
)
type user struct{
name string
}
View go-concurrency.go
package main
import (
"fmt"
//"time"
)
func moo (e chan string){
e <-"hello"
}
View lua-linked-list.lua
listc = {value = "boo", next = nil}
listb = {value = "tome", next = listc}
lista = {value = "chris", next = listb}
local l = lista
while l do
print(l.value)
l = l.next
end
View .Title
Using MongoDB in golang with mgo
View go-anonymous-struct.go
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, playground")
a := struct{
View go-reflect.go
package main
import (
"fmt"
"reflect"
//"encoding/json"
)
// must Capitlaize first letter
type user struct {
View react-form.js
import React from "react";
import ReactDOM from "react-dom";
class Form extends React.Component{
state= {
}
onChange(e){
this.setState( {...this.state, [e.target.name]: e.target.value})
console.log(this.state)