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 concurr | |
| import "sync" | |
| type routineGroup struct { | |
| waitGroup sync.WaitGroup | |
| } | |
| func newRoutineGroup() *routineGroup { | |
| return new(routineGroup) |
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
| // Metric interface | |
| type Metric interface { | |
| } | |
| var _ Metric = (*metric)(nil) | |
| type metric struct { | |
| } |
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
| // CompareVersion 比较字符串版本号 | |
| // a == b: true, a > b: true, a < b: false | |
| func CompareVersion(a, b string) bool { | |
| if a == b { | |
| return true | |
| } | |
| newv := strings.Split(a, ".") | |
| curv := strings.Split(b, ".") |
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" | |
| type One int | |
| type Ten int | |
| type work struct { | |
| object interface{} | |
| result chan error |
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
| cd ~ | |
| wget https://dl.google.com/go/go1.16.13.linux-amd64.tar.gz | |
| tar -C /usr/local -zxvf go1.16.13.linux-amd64.tar.gz | |
| echo "export GOROOT=/usr/local/go" > /etc/profile | |
| echo "PATH=$PATH:$GOROOT/bin" > /etc/profile | |
| source /etc/profile |
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 growslice(et *_type, old slice, cap int) slice { | |
| if raceenabled { | |
| callerpc := getcallerpc() | |
| racereadrangepc(old.array, uintptr(old.len*int(et.size)), callerpc, funcPC(growslice)) | |
| } | |
| if msanenabled { | |
| msanread(old.array, uintptr(old.len*int(et.size))) | |
| } | |
| if et.size == 0 { |
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 com.yibu.kuaibu.utils; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import java.io.ByteArrayInputStream; | |
| import java.io.ByteArrayOutputStream; | |
| import java.io.InputStream; | |
| /** |
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
| /** | |
| * Created by xufei on 4/8/15. | |
| */ | |
| var service; | |
| var map; | |
| function update_ui( address ) { | |
| $('#input').autocomplete("close"); | |
| $('#input').val(address); |
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
| /** | |
| * Created by xufei on 4/9/15. | |
| */ | |
| function search_box_gmaps() { | |
| var input = $('.pac-input').each(function(index, element) { | |
| var searchBox = new google.maps.places.SearchBox(element); | |
| google.maps.event.addListener(searchBox, 'places_changed', function() { | |
| var places = searchBox.getPlaces(); |
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
| begin | |
| Post.transaction do | |
| # 删除旧数据 | |
| Post.delete_all | |
| # 例子 新数据 | |
| datas [{:title => "title1", :slug => "title-1"},{:title => "Title 2", :slug => "Title 2"}] | |
| counter = 0 | |
| datas.each do |d| | |
| post = Post.new(d) |
NewerOlder