Skip to content

Instantly share code, notes, and snippets.

View hekt's full-sized avatar
🗼

Kazutoshi Horie hekt

🗼
View GitHub Profile
@hekt
hekt / ctrl-g-to-esc-unless-iterm2.json
Last active December 6, 2022 00:45
^g => esc unless iTerm2
{
"title": "esc = ctrl + g unless iTerm2",
"rules": [
{
"description": "Control + g => Escape unless iTerm2",
"manipulators": [
{
"from": {
"key_code": "g",
"modifiers": {
@hekt
hekt / notion-disable-ctrl-shift-j-hotkey.user.js
Created December 5, 2022 11:30
disable ^J on notion.so
// ==UserScript==
// @name Notion ^J disabler
// @namespace https://kzt.sh/
// @version 0.1
// @description disable ^J on notion.so
// @author [email protected]
// @match https://www.notion.so/*
// @grant none
// @run-at document-start
// ==/UserScript==
@hekt
hekt / .dir_colors
Created July 3, 2017 23:26
.dir_colors
# Configuration file for the color ls utility
# Synchronized with coreutils 8.5 dircolors
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.
# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
# off.
COLOR tty
@hekt
hekt / BigLetterView.h
Created November 17, 2014 13:34
MAC OS X COCOA プログラミング 23章で dragImage が使われているところ を beginDraggingSessionWithItems で書く
@interface BigLetterView : NSView <NSDraggingSource> {
NSColor *bgColor;
NSString *string;
NSMutableDictionary *attributes;
NSEvent *mouseDownEvent;
}
@hekt
hekt / LetterCountChallengeAppDelegate.swift
Created November 3, 2014 10:10
LetterCountChallenge アプリケーションの Swift 版 (『MAC OS X COCOA プログラミング』第5章)
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
@IBOutlet weak var textField: NSTextField!
@IBOutlet weak var textLabel: NSTextField!
@hekt
hekt / SpeakLineAppDelegate.swift
Created November 3, 2014 05:08
SpeakLine アプリケーションの Swift 版 (『MAC OS X COCOA プログラミング』第5章)
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
@IBOutlet weak var textField: NSTextField!
let speechSynth = NSSpeechSynthesizer(voice: nil)
@hekt
hekt / LotteryEntry.swift
Created November 2, 2014 13:43
lottery プロジェクト の Swift 版 (『MAC OS X COCOA プログラミング』3,4章)
import Foundation
class LotteryEntry: NSObject {
var entryDate: NSDate
var firstNumber: Int
var secondNumber: Int
init(initWithEntryDate theDate: NSDate) {
entryDate = theDate
firstNumber = random() % 100 + 1
@hekt
hekt / loader.js
Created April 4, 2014 13:13
JavaScript Loader
function jsLoader() {
"use strict";
var scripts = [].slice.call(arguments);
var reserves = [];
var thisScript = document.scripts[0] || document.querySelector("script");
var head = thisScript.parentNode;
if ("async" in thisScript)
parallel();
@hekt
hekt / background.js
Created July 25, 2013 12:44
skip hatebu
(function() {
var urls = ['http://b.hatena.ne.jp/entry/',
'http://zenback.itmedia.co.jp/contents/',
'http://ceron.jp/url/'];
chrome.tabs.onUpdated.addListener(function(tabid, inf, tab) {
for (var i = 0; i < urls.length; i++) {
if (inf.url.indexOf(urls[i]) === 0) {
var newUrl = inf.url.replace(/^(https?:\/\/).*?\/.*?\/(.*)$/, '$1$2');
chrome.tabs.update(tabid, {"url": newUrl});
@hekt
hekt / gist:4156521
Created November 27, 2012 19:42
parts of workflow that clip an item window from screenshot of borderlands (1280x800) and save it to dropbox
for f in "$@"
do
/usr/local/bin/convert -crop 486x331+647+408 "$f" "$HOME/Dropbox/Photos/Borderlands Weapons/${f##*/}"
done