bookmarklet.js: ブックマーク登録用の1行版。コメント無し。iOS は改行が潰れて//コメントがコードを飲むので、登録にはこちらを使う。bookmarklet.src.js: 読み書き用の複数行版(コメントあり)。
この2つは常に同時に編集する。bookmarklet.src.js を直したら、同じ内容を bookmarklet.js にも反映する(コメント行を除いて全行を空白で連結しただけのもの)。
| require 'bson' | |
| # 期待: from_time(t) で作った ObjectId の generation_time は t と一致する。 | |
| # unique: true でも「一意にする」だけで、タイムスタンプ部は t のままのはず。 | |
| t = Time.utc(2003, 4, 7) | |
| plain = BSON::ObjectId.from_time(t) | |
| unique = BSON::ObjectId.from_time(t, unique: true) | |
| puts "bson #{BSON::VERSION}" |
| #!/usr/bin/env python3 | |
| """PreToolUse hook: block write-method `gh api` calls. | |
| Allows GET-only `gh api` invocations to pass through to the normal permission | |
| check. Blocks any invocation that uses: | |
| - -X / --method with a non-read method (POST/PUT/PATCH/DELETE), | |
| including attached short form like -XPOST | |
| - -f / -F / --field / --raw-field (gh implicitly POSTs when these are set), | |
| including attached short form like -ftitle=foo | |
| - --input (reads body from file, implies POST) |
| """ | |
| CMYKテストパターン生成スクリプト | |
| - output_no_profile.jpg : ICCプロファイルなし(Twitterが誤変換するやつ) | |
| - output_with_profile.jpg: ICCプロファイルあり(正しく変換された場合) | |
| """ | |
| from PIL import Image, ImageDraw, ImageFont | |
| import struct | |
| W, H = 800, 1000 |
| def size = 400 | |
| def shake(base:, width:) | |
| base + width / 2 - rand(width) | |
| end | |
| foots = 6.times.map { } | |
| def setup | |
| createCanvas(size, size) |
| # frozen_string_literal: true | |
| source 'https://rubygems.org' | |
| # gem "rails" | |
| gem 'rubocop', '=1.67.0' |
| javascript:(function () { | |
| var map = document.getElementById('map'); | |
| map.width = 1800; // 特に意味のある値ではない。小さいとガビるので、適当にこれぐらい。元々のmapはサイズの指定のないimgなので適当に画面幅とかになっている? | |
| var c = document.createElement('canvas'); | |
| c.width = map.width; | |
| c.height = map.height; | |
| var ctx = c.getContext('2d'); | |
| ctx.drawImage(map, 0, 0); | |
| map.src = c.toDataURL(); | |
| })(); |
| if ENV['MACKEREL_AGENT_PLUGIN_META'] == '1' | |
| require 'json' | |
| meta = { | |
| :graphs => { | |
| 'dns.querytime' => { | |
| :label => 'time', | |
| :unit => 'integer', | |
| :metrics => [ | |
| { |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "strconv" | |
| ) | |
| type myVar struct { | |
| V int64 |
| #include <iostream> | |
| #include <array> | |
| #include <numbers> | |
| #include <cmath> | |
| int const N = 10; | |
| int prev(int n) { | |
| return (N + n - 1) % N; | |
| } | |
| double const dt = 0.0001; |