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)
View javascript-promises-async-await.js
// Write JavaScript here and press Ct
// promises and async/await
// thread, asynchronous
let a = new Promise(()=>{setTimeout(()=>{console.log("damn"), 10000})})
console.log("hello") // this function called concurrently, concurrence
// use function parameter as callback for some value in thread
let bb = new Promise( (resolve, error)=>{resolve("this is some value")} )
.then(value => { console.log(value) })
View react-open-close.js
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
class App extends React.Component{
constructor(props){
super(props)
this.state = {
open: false,
View go-type.go
package main
import (
"fmt"
"reflect"
)
type User struct{}
func typeof(v interface{}) string {
View react-list.js
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
const list = (text)=>(
text.map( (val) =>(
<ListItem>{val}</ListItem>
))
View react-this.js
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
class App extends React.Component {
constructor(){
super()
this.awesome = "love"
}
View javascript-this.js
function boo(){
console.log(this.name)
}
// bind simply passes "this" (object) to the function's argument
function cool(){
this.name = "tommy"
// passing current context of "this" to function
boo.bind(this)()
}