Skip to content

Instantly share code, notes, and snippets.

View cheebow's full-sized avatar

Motokazu Sekine cheebow

View GitHub Profile
@cheebow
cheebow / chordNotes.swift
Created August 24, 2024 03:55
ChordNotes
import Foundation
let noteToSemitone: [String: Int] = [
"C": 0, "C#": 1, "Db": 1,
"D": 2, "D#": 3, "Eb": 3,
"E": 4, "Fb": 4, "E#": 5,
"F": 5, "F#": 6, "Gb": 6,
"G": 7, "G#": 8, "Ab": 8,
"A": 9, "A#": 10, "Bb": 10,
"B": 11, "Cb": 11, "B#": 0
@cheebow
cheebow / gist:bfa3764395bf483740e662a2054ccf40
Last active August 24, 2023 06:17
[改][改]Google翻訳でページを翻訳すると語順がめちゃくちゃになるのを回避するブックマークレット(オリジナル:https://penpen-dev.com/blog/google/)
javascript:document.querySelectorAll('code').forEach(function(e)%7Bif(e.closest('pre'))%7Breturn%3B%7Dconst newElem%3Ddocument.createElement('span')%3Bwhile(e.firstChild)%7BnewElem.appendChild(e.firstChild)%3B%7Dfor(let index%3De.attributes.length - 1%3Bindex>%3D0%3B--index)%7BnewElem.attributes.setNamedItem(e.attributes%5Bindex%5D.cloneNode())%3B%7De.parentNode.replaceChild(newElem%2Ce)%3B%7D)%3Bvoid(0);
@cheebow
cheebow / tif2016.rb
Created July 21, 2016 02:02
TIF2016出演アイドル別に出演時間を表示する
require 'open-uri'
require 'json'
response = open('http://www.idolfes.com/2016/json/timetable/time.json')
data = response.read
json = JSON.parse(data)
artists = {}
json.keys.each{|day|
json[day].keys.each{|stage|
@cheebow
cheebow / Utils.swift
Last active October 23, 2015 07:46
performAfterDelay
import Foundation
class Utils {
class func performAfterDelay(block: dispatch_block_t, delayTime: Double) {
let delay = delayTime * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue(), block)
}
}
@cheebow
cheebow / gist:b37e4e5c9cc5b63d83e5
Created August 14, 2015 04:27
ナビゲーションバーの下線を消す
UINavigationBar.self.appearance().setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
UINavigationBar.self.appearance().shadowImage = UIImage()
import UIKit
class ColorButton: UIButton {
func setBackgroundColor(color: UIColor, forState state: UIControlState) {
self.setBackgroundImage(self.colorImage(color), forState: state)
}
func colorImage(color: UIColor)-> UIImage {
let size = CGSizeMake(1.0, 1.0)
let rect = CGRect(origin: CGPointZero, size: size)
// ==UserScript==
// @name showroom star aggregator
// @namespace http://nipotan.com/
// @version 0.8
// @description 特定のルームには連射ボタン等があり、他は閉じるだけ
// @match https://www.showroom-live.com/*
// @grant none
// @copyright 2014 nipotan
// ==/UserScript==
$(document).ready(function(){
@cheebow
cheebow / MYViewController.h
Last active December 24, 2015 13:48
CMStepCounter Sample
#import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
@interface MYViewController : UIViewController
@property (nonatomic, strong) CMStepCounter *stepCounter;
@end
@cheebow
cheebow / gist:5036922
Created February 26, 2013 08:18
UISliderを縦にする
- (void)viewDidLoad
{
[super viewDidLoad];
UISlider *slider = [[UISlider alloc] init];
slider.center = self.view.center;
slider.transform = CGAffineTransformMakeRotation(M_PI * -90.0 / 180.0);
[self.view addSubview:slider];
[slider autorelease];
}