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
| func TestSha1(t *testing.T) { | |
| v := map[string]string{"name": "Felix", "age": "18"} | |
| e := &v | |
| //e := &[]string{"hi"} | |
| sh1 := sha1.New() | |
| io.WriteString(sh1, "q3244214") | |
| ge := gob.NewEncoder(sh1) | |
| ge.Encode(e) | |
| fmt.Println(".........!") |
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
| //$('.qor-notify-number').hide(); //红色通知,还是留着吧... | |
| $('.qor-notify-num-grey').hide(); //灰色未读数不要 | |
| $('.new-stream-bar').remove(); //不要主动推送消息 |
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" | |
| "math" | |
| "math/cmplx" | |
| ) | |
| func equal(x, y complex128) bool { | |
| delta := 0.000001 |
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" | |
| "math/cmplx" | |
| "math" | |
| ) | |
| func equal(x, y complex128) bool { | |
| delta := 0.0001 |
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
| onLocalSearchResult: function(items, q){ | |
| var newItems = new Array(); | |
| $.each(items, function(index, item){ | |
| names = item.Name.split(" "); | |
| $.each(names, function(i, name){ | |
| if(name.toLowerCase().slice(0,q.length) == q){ | |
| newItems.push(item); | |
| return false | |
| } | |
| }) |
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 ( | |
| "github.com/bmizerany/pat" | |
| "io" | |
| "log" | |
| "net/http" | |
| ) | |
| // hello world, the web server |
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 "fiber" | |
| f1 = Fiber.new { |f2| f2.resume Fiber.current;loop{puts "A"; f2.transfer} } | |
| f2 = Fiber.new { |f1| f1.transfer; loop{puts "B"; f1.transfer} } | |
| f1.resume f2 |
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
| class Proxy | |
| def initialize(target_object) | |
| @object = target_object | |
| # ADD MORE CODE HERE | |
| @call_count = {} | |
| end | |
| attr_accessor :channel | |
| def proxy_call(m, *args) |
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 "readline" | |
| class Player | |
| def play_turn(w) | |
| # add your code here | |
| buf = Readline.readline("> ", true ) | |
| action=buf[0] | |
| direction=buf[1] | |
| abilities = {'w' => 'w.walk!', 'a' => 'w.attack!', 'r' => 'w.rest!', 'c' => 'w.rescue!', 's' => 'w.shoot!', 'b' => 'w.bind!', 'd' => 'w.detonate!'} | |
| directions = {'l' => ':forward', 'h' => ':backward', 'j' => ':right', 'k' => ':left'} |
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
| # Ruby 1.9.2 | |
| # Home: https://gist.github.com/856219 | |
| # My CPP template: template_cpp.rb | |
| # OJ Support: | |
| # Online Judge of Zhejiang University | |
| # Author: [email protected] | |
| require 'uri' | |
| require 'net/http' | |
| #require 'hpricot' |
NewerOlder