View masawada-cast.html
This file contains 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
<p><button id="masawada-cast-button" style="display: none">masawada castを開始する</button> | |
<div id="masawada-cast-button-not-supported" style="display: none">お使いのブラウザは<a href="https://developer.mozilla.org/en-US/docs/Web/API/Presentation_API" target="_blank">Presentation API</a>に対応していないようです</div> | |
</p> | |
<script> | |
(function () { | |
const button = document.querySelector('#masawada-cast-button'); | |
const error = document.querySelector('#masawada-cast-button-not-supported'); | |
const show = function () { | |
button.style.display = 'block'; | |
}; |
View slack_speech.js
This file contains 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
(() => { | |
const speak = (body, isRetry) => { | |
window.speechSynthesis.cancel() | |
if (!body) return; | |
console.log('speak ' + body); | |
const synth = window.speechSynthesis; | |
const allVoices = synth.getVoices(); | |
const jaVoices = allVoices.filter(v => v.lang === 'ja-JP'); | |
const voice = jaVoices[0]; | |
if (!voice && !isRetry) { |
View crawl.js
This file contains 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
function crawl() { | |
var content = UrlFetchApp.fetch("https://tsukurioki.hatenablog.com/about").getContentText(); | |
var entries = content.match(/(\d+) 記事/)[1]; | |
var subscribers = content.match(/(\d+) 人/)[1]; | |
Logger.log(subscribers); | |
var sheet = SpreadsheetApp.openById("*************************").getSheetByName('data'); | |
var newRow = [new Date(), +entries, +subscribers]; | |
sheet.appendRow(newRow); | |
} |
View animate_lqr_horizontal.sh
This file contains 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
#!/bin/sh | |
# | |
# Create a animation of of a rotating image. | |
# Some alpha composition is used to crop the result to the original size. | |
# | |
command="convert -delay 10 $1 -resize 50% -trim +repage -bordercolor white" | |
command="$command \\( +clone -border 1x1 -fill lightsteelblue" | |
command="$command -colorize 100% \\) -gravity center" | |
for i in `seq 100 -2 20 ;`; do |
View oJqueryArgumentRule.ts
This file contains 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
import * as ts from "typescript"; | |
import * as Lint from "tslint"; | |
export class Rule extends Lint.Rules.AbstractRule { | |
/* tslint:disable:object-literal-sort-keys */ | |
public static metadata: Lint.IRuleMetadata = { | |
ruleName: "no-jquery-argument", | |
description: "Disallows receiving jQuery object in arguments.", | |
rationale: Lint.Utils.dedent` | |
Do not receive jQuery Object. You must receive HTMLElement or Array<HTMLElement>. |
View interactive.rb
This file contains 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
# replace HERE interactive, execute command. | |
# for example: ruby interactive.rb expr HERE + HERE + HERE | |
require 'readline' | |
require 'shellwords' | |
HERE = /HERE/ | |
def read_input | |
Readline.readline("> ", true) |
View theseus.rb
This file contains 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
# git ls-files | ruby theseus.rb | sort | uniq -c | |
require 'time' | |
ARGF.each_line.each_with_index {|file, index| | |
blame = `git blame -c #{file}`.encode('utf-8', invalid: :replace, undef: :replace, replace: '').split(/\n/) | |
blame.each{|line| | |
puts Time.parse(line.split(/\t/)[2]).year | |
} | |
} |
View prt-introduce-variables.el
This file contains 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
(defun prt-introduce-variables () | |
(interactive) | |
(if mark-active | |
(let ( | |
(resultbuf (get-buffer-create "*introduce-variables*")) | |
) | |
(with-current-buffer resultbuf | |
(setq buffer-read-only nil) | |
(erase-buffer) | |
) |
View Immurable.pm
This file contains 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
use strict; | |
use warnings; | |
use URI; | |
use DateTime; | |
use Test::More; | |
package Immutable { | |
sub new { | |
my ($class, $obj) = @_; | |
bless { |
View Gemfile
This file contains 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
gem "urls", git: "https://gist.github.com/8e3fde72960e9adbbc7b5cbf4e0d5861.git" |
NewerOlder