Skip to content

Instantly share code, notes, and snippets.

@knight1128
knight1128 / Java8Test
Created May 15, 2015 15:25
java 8 lamda sort vs java 7 sort
package com.google.locationlab;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
import com.google.common.primitives.Ints;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.junit.Before;
import org.junit.Test;
@knight1128
knight1128 / PortalRestTemplateIntegrationTest
Created May 15, 2015 14:43
rest template with utf-8 text/html
package com.google.locationlab;
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.springframework.http.*;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate;
@knight1128
knight1128 / RestTemplateIntegrationTest
Created May 15, 2015 14:32
rest template with object mapping example code in utf8 communication
package com.google.locationlab;
import com.google.common.collect.Lists;
import com.google.locationlab.model.LocationResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
@knight1128
knight1128 / print-time-interval.rb
Created May 6, 2015 10:32
print time interval by ruby
require 'date'
require 'time'
require 'optparse'
options = {:start_time => nil, :end_time => nil, :interval => nil}
parser = OptionParser.new do|opts|
opts.banner = "Usage: print-time-interval.rb --time [MIN | HOUR | DAY] --interval [5MIN | HOUR | DAY]"
opts.on('-s', '--start_time time', 'time') do |time|
options[:start_time] = time;
package main
import "fmt"
func main() {
fmt.Println("test")
}
// $ go run test.go
// $ go build test.go