Skip to content

Instantly share code, notes, and snippets.

View GeneralD's full-sized avatar
💭
Alcohol makes better code 🥃

YUMENOSUKE GeneralD

💭
Alcohol makes better code 🥃
View GitHub Profile
@GeneralD
GeneralD / .zprofile
Created October 29, 2013 09:26
Macアプリケーションをプロンプトから全てアプリ名だけで起動出来るzsh設定 ref: http://qiita.com/GeneralD@github/items/58588e22fe7bb3e10205
# aliases to Mac Applications
function app_alias() {
apps=$(find $1/*.app -maxdepth 0)
apps=(${(@f)"$(echo $apps)"})
for app in $apps
do
aliasname=$(echo $app | sed 's/.app//' | sed 's!^.*/!!')
aliasname=$(echo $aliasname | sed -e 's/ //g')
app=$(echo $app | sed -e 's/\ /\\ /g')
@GeneralD
GeneralD / NSMutableArray+YKFileArray.h
Created July 12, 2014 09:23
Objective-C唯一のiOSファイルパスライブラリ、YKFileの説明書 ref: http://qiita.com/GeneralD/items/b8bd37b1f698ee98fe58
- (void)eachFile:(void (^)(YKFile *file, NSUInteger idx))pFunction;
- (void)sortFiles:(NSComparisonResult (^)(YKFile *file1, YKFile *file2))pFunction;
- (void)removeFilesFromList:(BOOL (^)(YKFile *file))pFunction;
- (YKFileArray *)cutFilesFromList:(BOOL (^)(YKFile *file))pFunction;
@GeneralD
GeneralD / file0.txt
Created July 20, 2017 06:41
zshのパス設定の順序の問題 ref: http://qiita.com/GeneralD/items/a87d5d145149a9d214c6
echo $PATH
@GeneralD
GeneralD / expand-or-complete-with-dots.zsh
Last active November 28, 2017 05:21
Zsh shows waiting dots when completing
WAITING_DOTS=${WAITING_DOTS:-"..."}
expand-or-complete-with-dots() {
echo -n $WAITING_DOTS
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots
@GeneralD
GeneralD / partial-search-history-with-arrow-keys.zsh
Last active November 28, 2017 05:29
Zsh partial search history
# history searching with arrow keys
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[[A" up-line-or-beginning-search # Up
bindkey "^[[B" down-line-or-beginning-search # Down
@GeneralD
GeneralD / file0.txt
Last active January 7, 2018 13:03
唸れ!重装系ZSH!次世代のトレンドを体験せよ。 ref: https://qiita.com/GeneralD/items/7aad84a6560206dc6e45
export ZPLUG_HOME=/usr/local/opt/zplug
source $ZPLUG_HOME/init.zsh
#!/usr/bin/env zsh
if [[ $# -lt 2 ]]; then
echo "Usage: ${0##*/} [repo's url] [directory you want to clone]"
exit
fi
local dir=${1##*/}
mkdir $dir
local tmpdir=`pwd`
#!/usr/bin/env bash
# Parameters
NBINS=20
INTERVAL=1
PROCESSES=("Google Chrome")
# Set process
if [ $# -gt 0 ];then
PROCESSES=("$@")
#!/usr/bin/env sh
## This script uses several commands. They can be install with...
## $ gem install notify-my-android
## $ gem install prowl
## $ brew install terminal-notifier
NMA_KEY=${NMA_KEY:-"YOUR_KEY"}
PROWL_KEY=${PROWL_KEY:-"YOUR_KEY"}
# Mac Applications in 'Applications' directories -> runnable from the terminal
() {
local app dir
for dir in $@; do
for app in $dir/*.app(N); do; alias ${app:t:r:gs/ //}="open -a ${app:gs/ /\\ /}"; done
for app in $dir/*/*.app(N); do; alias ${app:t:r:gs/ //}="open -a ${app:gs/ /\\ /}"; done
done
} /Applications ~/Applications
# Open the directory with Finder (Open current directory without argument)