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 / 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 / .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 / 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
#!/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"}
# usage sample: echo Let\'s ${RED}color${CLEAR} text!
CLEAR='\033[0m'
BLACK='\033[0;30m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
constructor(private iab: InAppBrowser) {}
openUrl(url: string, externalBrowser: boolean = false) {
const target = externalBrowser ? '_system' : '_blank';
this.iab.create(url, target, TopicDetailPage.options);
}