Skip to content

Instantly share code, notes, and snippets.

View a.vbs
Option Explicit
' スート。下ほど強い (ついでに入れたJOKER除く)
Enum suit
JOKER
Spade
Heart
Diamond
Clover
End Enum
View atom.ts
// deno run --unstable https://raw.githubusercontent.com/zakuroishikuro/sharin/main/asobu/atom.ts
//
// original source code:
// https://github.com/mame/trance-book/blob/master/8-1/subcharacter-rendering-demo.rb
//
// from:
// あなたの知らない超絶技巧プログラミングの世界 by 遠藤侑介
// 8-1-2 アスキーアートの生成(1):サブキャラクターレンダリング
import { complex, multiply } from "https://cdn.skypack.dev/mathjs";
View get_center_cell_of_shape.vb
Function get_center_cell_of_shape(s As Shape) As Range
Dim center_x As Double: center_x = s.Left + s.Width / 2
Dim center_y As Double: center_y = s.Top + s.Height / 2
Dim r As Range: Set r = s.TopLeftCell
Do Until r.Left <= center_x And center_x <= r.Left + r.Width
Set r = r.Offset(columnoffset:=1)
Loop
View cycle_fizzbuzz.rb
fizz = [nil] * 2 << :Fizz
buzz = [nil] * 4 << :Buzz
(1..100).zip(fizz.cycle, buzz.cycle) do |n, *f|
puts f.any? && f.join || n
end
# (1..100).zip(([nil]*2<<:Fizz).cycle,([nil]*4<<:Buzz).cycle){|n,*z|puts z.any?&&z*""||n}
@zakuroishikuro
zakuroishikuro / simple_synth.html
Created Apr 22, 2016
シンプルなシンセサイザー的な何か
View simple_synth.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background-image:
repeating-linear-gradient(90deg, transparent, transparent calc(100% / 12 - 1px), black calc(100% / 12 - 1px), black calc(100% / 12)),
repeating-linear-gradient( 0deg, transparent, transparent calc(100% / 8 - 1px), black calc(100% / 8 - 1px), black calc(100% / 8));
}
@zakuroishikuro
zakuroishikuro / virtual_keyboard.html
Created Apr 21, 2016
動けばいいやって感じで書きなぐったバーチャルキーボード
View virtual_keyboard.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.keyboard {
width: 600px;
}
button {
width: 4em;
height: 4em;
View simple_html_piano.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
button {
width: 5em;
height: 8em;
box-shadow: 0px 3px 2px gray;
text-shadow: 0px 3px 3px gray;
transition: 0.1s;
View calc_piano_frequency.bas
' VBA
Private Const COMMON_RATIO As Double = 2 ^ (1 / 12) '1.0594630943592953...
Function calc_piano_frequency(Optional key_index As Integer = 49, Optional pitch As Integer = 440) As Double
Dim ratio As Double
ratio = COMMON_RATIO ^ (key_index - 49)
calc_piano_frequency = pitch * ratio
End Function
@zakuroishikuro
zakuroishikuro / doremi.html
Last active Apr 20, 2016
どれみ再生機
View doremi.html
<style>
body { background-color: #CCC; }
textarea { width: 500px; height: 300px; }
</style>
<script>
var ctx, gain;
window.addEventListener("DOMContentLoaded", ()=>{
ctx = new AudioContext();
gain = ctx.createGain();
@zakuroishikuro
zakuroishikuro / styles.less
Created Mar 31, 2016
Atom Background Image (white theme recommended)
View styles.less
.tree-view, .tab, status-bar { font-family: klee, serif }
atom-text-editor { font-family: menlo, klee, monospace }
body:after{
// 背景の設定
background-image: url("http://40.media.tumblr.com/29401a5705bfb798141e04a581f0c98f/tumblr_nh8vlsfsoW1qbo867o1_1280.jpg");
background-position: right bottom -350px;
background-repeat: no-repeat;
//background-size: contain;