Skip to content

Instantly share code, notes, and snippets.

View shicky's full-sized avatar

Steve shicky

View GitHub Profile
import aiohttp
import asyncio
import time
urls_i = [
"http://google.com",
"https://stackoverflow.com"
]
urls = []
/*
Sick Yoon (shicky@gmail.com) (c) 2016
Table Component for React
*/
const React = require('react');
const rowData = [
{
id: {type: 'text', data: '1243556'},
@shicky
shicky / react_onchange_technique.js
Last active June 16, 2016 10:34
Handling checkbox
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});
},
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({
package main
import (
"fmt"
"sync"
"time"
)
type Job struct {
url string
@shicky
shicky / init_double_dict.py
Created July 11, 2016 03:04
Initialize Python Double Dict with -1
from collections import defaultdict
d = defaultdict(lambda: defaultdict(lambda: -1))
print(d[544][465]) # should be -1
@shicky
shicky / algorithm.java
Last active July 13, 2016 06:11
Java Syntax
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
package main
import (
"fmt"
"reflect"
)
func main() {
// register method
tasks := make(map[string]interface{})
tasks["add"] = add
@shicky
shicky / reflect_convert.go
Created July 15, 2016 10:35
Convert reflect.Value to appropriate variable
package gocelery
import (
"reflect"
"strconv"
)
// GetRealValue returns real value of reflect.Value
func GetRealValue(val reflect.Value) interface{} {
switch val.Kind() {
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)