go test -cover -coverprofile=c.out
go tool cover -html=c.out
| # helloworld.c | |
| # gcc helloworld.c -o helloworld | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| int main() { | |
| puts("Hello world!\n"); | |
| return 0; | |
| } |
| package main | |
| import "github.com/miekg/dns" | |
| // ResolveIP resolves IP address using provided DNS server | |
| func ResolveIP(url, server string) (string, error) { | |
| msg := new(dns.Msg) | |
| msg.Id = dns.Id() | |
| msg.RecursionDesired = true | |
| msg.Question = make([]dns.Question, 1) |
| package gocelery | |
| import ( | |
| "reflect" | |
| "strconv" | |
| ) | |
| // GetRealValue returns real value of reflect.Value | |
| func GetRealValue(val reflect.Value) interface{} { | |
| switch val.Kind() { |
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| func main() { | |
| // register method | |
| tasks := make(map[string]interface{}) | |
| tasks["add"] = add |
| public static void main(String[] args) { | |
| // data type and max values | |
| /* | |
| width minimum maximum | |
| byte: 8 bit -128 +127 | |
| short: 16 bit -32 768 +32 767 | |
| int: 32 bit -2 147 483 648 +2 147 483 647 | |
| long: 64 bit -9 223 372 036 854 775 808 +9 223 372 036 854 775 807 | |
| float: 32 bit 1.4E-45 3.402,823,5E+38 |
| from collections import defaultdict | |
| d = defaultdict(lambda: defaultdict(lambda: -1)) | |
| print(d[544][465]) # should be -1 |
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| type Job struct { | |
| url string |
| const React = require('react'); | |
| // sample callback | |
| function onCheckboxClicked(e, id) { | |
| console.log(e.target.id); | |
| console.log(e.target.checked); | |
| //store.dispatch(ReduxActions.updateSomething(something)); | |
| } | |
| const CheckboxInput = React.createClass({ |
| const Form = require('react-bootstrap/lib/Form'); | |
| const FormGroup = require('react-bootstrap/lib/FormGroup'); | |
| const FormControl = require('react-bootstrap/lib/FormControl'); | |
| const Col = require('react-bootstrap/lib/Col'); | |
| const ControlLabel = require('react-bootstrap/lib/ControlLabel'); | |
| onChangeValue(evt, check=false) { | |
| this.setState({[evt.target.id]: check?evt.target.checked:evt.target.value}); | |
| }, |