View comparable_bench.rb
# frozen_string_literal: true
require 'benchmark'
class SizeMatters
include Comparable
attr :str
def <=>(other)
str.size <=> other.str.size
end
def initialize(str)
View clamp_bench.rb
require 'benchmark'
Benchmark.bmbm do |x|
v = Random.rand(-10..110)
x.report "minmax:" do
10000000.times { [99, [0, v].max].min }
end
x.report "clamp: " do
View gist:09b3f34848c6c1293de1f6e99c90cdc1
### Keybase proof
I hereby claim:
* I am kei-s on github.
* I am kei_s (https://keybase.io/kei_s) on keybase.
* I have a public key whose fingerprint is 6B52 13DA 6F4B 48F5 5B42 AE34 931D 3783 8649 E80C
To claim this, I am signing this object:
View hikisuu.rb
@gomobako = 🗑
def gomibako_ni_suteru(gomi)
@gomibako.akeru
@gomibako.ireru(gomi)
@gomibako.shimeru
end
cd = 💿
if cd.wareta?
gomobako_ni_ireru(cd)
View Post.js
// https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
// 1. Enter sheet name where data is to be written below
var SHEET_NAME = "購入ログ";
// 2. Run > setup
//
// 3. Publish > Deploy as web app
// - enter Project Version name and click 'Save New Version'
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
View sendMail.js
function sendMail() {
var today = new Date();
var MAIL_TO = "メールアドレス";
var cycles = (function() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("サイクル");
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
return values;
View answer_exercise_gotour_70.go
package main
import (
"code.google.com/p/go-tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
View pivotal-to-trello.rb
require 'csv'
require 'pry'
require 'trello'
Trello.configure do |config|
config.developer_public_key = 'TRELLO_PUBLIC_KEY'
# Access https://trello.com/1/authorize?key=#{substitutewithyourapplicationkey}&name=My+Application&expiration=1day&response_type=token&scope=read,write
config.member_token = 'ACCESS_TOKEN'
end
View answer_exercise_gotour_61.go
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
View answer_exercise_gotour_60.go
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct {
width int