Skip to content

Instantly share code, notes, and snippets.

# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Uber
description: Move your app forward with the Uber API
version: "1.0.0"
# the domain of the service
host: api.uber.com
# array of all schemes that your API supports
// gomoku_2016_01_18.txt
// https://gist.github.com/bsoo/bd361a7fe01fc6bff068
package main
import "strings"
func lesson01(num int) {
asterisk := 1
blank := num / 2
// gomoku_2016_01_18.txt
// https://gist.github.com/bsoo/bd361a7fe01fc6bff068
func isPrime(n int) bool {
if n < 2 {
return false
} else if n == 2 {
return true
}
@ohkawa
ohkawa / sample_bit.go
Last active January 2, 2016 01:38
Goでバケットソートアルゴリズム(ビット列を使用) ref: http://qiita.com/ohkawa/items/269507985b3ae10cbff9
package main
import (
"bufio"
"fmt"
"log"
"math"
"os"
"strconv"
"time"
@ohkawa
ohkawa / badSample.go
Last active January 1, 2016 08:16
min-maxの範囲からn個の整数をランダム抽出する方法(ただし重複は含まない) ref: http://qiita.com/ohkawa/items/c5e703459a1fe5cb83d0
package main
import (
"fmt"
"math/rand"
"time"
)
func pickupSort(min int, max int, num int) []int {
numRange := max - min
@ohkawa
ohkawa / UIImage+PixelColor.swift
Last active July 13, 2018 20:20
[Swift] 画像の特定のピクセルの色を調べる ref: http://qiita.com/ohkawa/items/71db370b5a6b75bae517
import UIKit
let pixelDataByteSize = 4
extension UIImage {
func getColor(pos: CGPoint) -> UIColor {
let imageData = CGDataProviderCopyData(CGImageGetDataProvider(self.CGImage))
let data : UnsafePointer = CFDataGetBytePtr(imageData)