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
// Copyright 2013 Gary Burd | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"): you may | |
// not use this file except in compliance with the License. You may obtain | |
// a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
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 FibI interface { | |
Fib(n int) int | |
Wrap(fib FibI) FibI | |
} | |
type Fib 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
func Handler(meta endpoint.Meta, next endpoint.Endpoint) endpoint.Endpoint { | |
profMapLock.Lock() | |
defer profMapLock.Unlock() | |
traceBytes := []byte{} | |
tracePtr := &traceBytes | |
var lock sync.Mutex | |
var buf bytes.Buffer | |
var traceBuf bytes.Buffer |
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
def median(A, B): | |
m, n = len(A), len(B) | |
if m > n: | |
A, B, m, n = B, A, n, m | |
if n == 0: | |
raise ValueError | |
imin, imax, half_len = 0, m, (m + n + 1) / 2 | |
while imin <= imax: | |
i = (imin + imax) / 2 |
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 versionlock | |
import ( | |
"errors" | |
"sync/atomic" | |
"time" | |
) | |
var ErrOldVersion = errors.New("old version") | |
var ErrUnlockFailed = errors.New("unlock failed") |
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 fieldSet(fields ...string) map[string]bool { | |
set := make(map[string]bool, len(fields)) | |
for _, s := range fields { | |
set[s] = true | |
} | |
return set | |
} | |
func IgnoreFields(v interface{}, fields ...string) map[string]interface{} { |
OlderNewer