This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| func main() { | |
| //var a = 1 | |
| //var p *int = &a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "net" | |
| ) | |
| func main() { | |
| conn, err := net.Dial("tcp", "localhost:9002") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'jo' | |
| include Jo | |
| java_import java.lang.System | |
| java_import java.util.Date | |
| puts Date.new(System::currentTimeMillis) | |
| # pinger ponger printer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "database/sql" | |
| "fmt" | |
| "log" | |
| // load postgres driver | |
| _ "github.com/lib/pq" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "unicode/utf8" | |
| ) | |
| func main() { | |
| fmt.Println(reverse("abc")) | |
| fmt.Println(reverse("中文")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| s = "export GOPATH=/home/itang/sources/go-projects\n" | |
| s = s + File.readlines("/home/itang/tmp/3.g") | |
| .select{|line| line.start_with?("Unstar")} | |
| .map{|line| line.split(" ")[1]} | |
| .map{|p| "go get -v github.com/#{p}"} | |
| .join("\n") | |
| File.open("/home/itang/tmp/3.sh", "w") do |f| | |
| f.write(s) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'open-uri' | |
| url = 'https://github.com/mozilla/rust/wiki/Rustpkg' | |
| projects = open(url).read().scan(/<a .*>.*<\/a>/) | |
| .select {|a| a.match("https://github.com/") } | |
| .reject {|a| a.match("https://github.com/mozilla/")} | |
| projects.each do |a| | |
| href = a.match(/"(.*)"/)[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/home/itang/.rvm/rubies/ruby-2.0.0-p353/bin/ruby | |
| # encoding: utf-8 | |
| # save as file "rust" | |
| def println_info(task, file) | |
| puts "Rust Launcher..." | |
| puts "#{'work dir'.ljust(10)}:#{Dir.getwd}" | |
| puts "#{'task'.ljust(10)}:#{task}" | |
| puts "e.g. | |
| $ ./rust run hello.rs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn main() { | |
| println("Hello? yes , this is rust"); | |
| let hi = "hi"; | |
| let mut count = 0; | |
| while count < 10 { | |
| println(hi); | |
| println(format!("{:s} is {:d}", hi, count)); | |
| count += 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| go get -u -v github.com/codegangsta/martini | |
| go get -u -v github.com/codegangsta/martini-contrib/... | |
| go get -u -v github.com/robfig/revel/... |