Skip to content

Instantly share code, notes, and snippets.

View kkazuo's full-sized avatar

Koga Kazuo kkazuo

View GitHub Profile
@kkazuo
kkazuo / NSObject+KVOHelper.h
Created May 19, 2012 16:44
KVOHelper. Easy Key-Value Observing
// AUTHOR: Kazuo Koga
// LICENSE: MIT
#import <Foundation/Foundation.h>
@interface NSObject (KVOHelper)
- (id)addObserveBlockForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options with:(void (^)(NSDictionary *change))block;
- (void)removeObserveBlockForKeyPath:(NSString *)keyPath withID:(id)contextID;
+ (NSString *)descriptionOfObserveBlock;
@kkazuo
kkazuo / .mykermrc
Created June 30, 2012 14:23
MacでUSBシリアルでYAMAHA RTX1100に接続
# brew install c-kermit
set modem type none
set line /dev/tty.usbserial-FTFLINQT
set carrier-watch off
set speed 9600
set parity even
set stop-bits 1
set flow xon/xoff
eightbit
@kkazuo
kkazuo / gist:5143450
Created March 12, 2013 14:44
Objective-C cascade message syntax proposal.
> [obj message1].[message2].[message3:arg1].[message4:arg2 with:arg3];
is equive to
> [[[[obj message1] message2] message3:arg1] message4:arg2 with:arg3];
just propose.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C1154025-FCAB-40AF-A715-91D10420C321}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
@kkazuo
kkazuo / hyphen.jsx
Created June 11, 2015 12:07
Adobeイラストレータスクリプト テキストオブジェクトまたはその選択領域の"-"のベースラインを上げる(電話番号とか)
var dia = new Window("dialog", "ハイフンあげ", [0, 0, 250, 110]);
dia.pane1 = dia.add("panel", [5, 10, 240, 60], "0.5");
dia.tex1 = dia.pane1.add("edittext", [10, 10, 100, 30]);
dia.add("statictext", [110, 30, 240, 50], "pt");
dia.bot1 = dia.add("button", [10, 70, 100, 100], "実行", {
name: "OK"
});
dia.tex1.text = 0.5;
dia.center();
dia.show();
@kkazuo
kkazuo / inst.sh
Created June 25, 2015 10:54
Macにgcc-modをインストールするwith stack
#!/bin/sh -e
mkdir -p ~/.local/bin
cd ~/.local/bin
curl -LO https://github.com/commercialhaskell/stack/releases/download/v0.1.0.0/stack-0.1.0.0-x86_64-osx.gz
gunzip stack-0.1.0.0-x86_64-osx.gz
mv stack-0.1.0.0-x86_64-osx stack
chmod +x stack
mkdir /tmp/ghcmod
cd /tmp/ghcmod
@kkazuo
kkazuo / cohttp_ssl_version.ml
Created March 15, 2017 15:25
cohttp with async_ssl : If you get SSL handshake error, specify version of ssl_config
open Core.Std
open Async.Std
module Http = Cohttp_async
let ssl_config =
Conduit_async.Ssl.configure ~version:Tlsv1_2 ()
let main key () =
Http.Client.get Uri.(of_string key) ~ssl_config >>= fun (res, body) ->
@kkazuo
kkazuo / VirtualList.re
Created March 21, 2019 15:05
ReasonReact binding of react-virtualized/List
[@bs.module "react-virtualized"]
external reactClass: ReasonReact.reactClass = "List";
[@bs.deriving abstract]
type cellProps = {
index: int,
isScrolling: bool,
isVisible: bool,
key: string,
style: ReactDOMRe.Style.t,
@kkazuo
kkazuo / gist:2c447454a5476659b897a1f0130e945b
Created March 3, 2022 22:53
When connect error to melpa.org on Emacs 27.2 with macOS
(custom-set-variables
'(gnutls-algorithm-priority "normal:-vers-tls1.3"))
@kkazuo
kkazuo / gist:152f1a05364d47110049e67bcf4d7a05
Created August 24, 2024 01:26
Emacs 29 のフォント設定
(let ((family "UDEV Gothic LG"))
(set-face-attribute 'default nil :family family)
(set-face-attribute 'fixed-pitch nil :family family)
(set-face-attribute 'fixed-pitch-serif nil :family family))