Skip to content

Instantly share code, notes, and snippets.

yuuAn yuuan

Block or report user

Report or block yuuan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yuuan
yuuan / _artisan
Created Sep 27, 2016
Zsh で Laravel5 の artisan コマンドを補完
View _artisan
#compdef artisan
function __laravel5_get_command_list() {
which php &> /dev/null || return
which perl &> /dev/null || return
if [[ -f artisan ]]; then
php artisan list --raw | perl -pe 's/:/\\:/g;s/([a-z\\:-]+)(?:\s+(.*))?/$1:$2/ig;'
fi
}
View notify-send
#!/usr/bin/perl
use common::sense;
use IPC::System::Simple qw(systemx);
my @arguments = @ARGV;
my @ignores = qw/
-u --urgency
-t --expire-time
View git-branch-clear.zsh
#!/bin/zsh -eu
function __info() {
echo -e "\e[32m$*\e[m"
}
__info "# git fetch --prune"
git fetch --prune
@yuuan
yuuan / peco-tmux
Last active Apr 13, 2016
fzf-tmux to peco
View peco-tmux
#!/usr/bin/env bash
# peco-tmux: starts peco in a tmux pane
# usage: peco-tmux [-u|-d [HEIGHT[%]]] [-l|-r [WIDTH[%]]] [--] [PECO OPTIONS]
args=()
opt=""
skip=""
swap=""
close=""
term=""
@yuuan
yuuan / httpd-writable-on-selinux.zsh
Created Dec 2, 2015
SELinux が有効な環境で、指定したディレクトリに対して HTTPD が書き込みできるようにするスクリプト。
View httpd-writable-on-selinux.zsh
#!/bin/zsh -eu
function writable {
TARGET=$*
echo -e "\e[37m'$TARGET'\e[m のパーミッションを変更します。"
/usr/bin/sudo /usr/bin/chmod -R a+w "$TARGET"
echo -e "\e[37m'$TARGET'\e[m に \e[32m'httpd_sys_rw_content_t'\e[m を付与します。"
/usr/bin/sudo /usr/sbin/semanage fcontext -a -t httpd_sys_rw_content_t "$TARGET(/.*)?"
@yuuan
yuuan / configure-vim.sh
Created Nov 4, 2015
Configure vim on Fedora
View configure-vim.sh
#!/bin/sh
./configure --enable-multibyte --with-features=huge --disable-selinux \
--prefix=/usr/local \
--enable-luainterp=yes --with-luajit \
--enable-perlinterp=dynamic \
--enable-rubyinterp=dynamic \
--enable-pythoninterp=dynamic --enable-python3interp=dynamic \
--enable-fail-if-missing
View translate-date-in-gitlab.js
// ==UserScript==
// @name Translate DateTime in GitLab
// @namespace http://www.yuuan.net/item/1054
// @description 英語で書かれた日付を数字に変える
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @include http://gitlab.com/*
// @version 0.1
// @grant none
// ==/UserScript==
(function($) {
View blade-extension.php
<?php
/**
* `@param` で渡された変数が宣言されていないときに、
* `debug` モードならエラーを出し、そうでなければ宣言して null を代入する
*
*/
Blade::extend(function($view, $compiler)
{
$pattern = $compiler->createMatcher('param');
@yuuan
yuuan / color-scheme-for-view-source.css
Last active Aug 29, 2015
Firefox で `ページのソースを表示` したときのデザインを上書きするためのスタイルシート
View color-scheme-for-view-source.css
@-moz-document url-prefix(view-source) {
body {
margin: 0;
}
#viewsource {
font-family: "Ricty";
font-size: 10pt;
line-height: 135%;
}
#line1:before {
@yuuan
yuuan / AppModel.php
Created Aug 21, 2014
CakePHPで `created` の代わりに `created_at` を使うようにするために AppModel を強引にいじってみた。
View AppModel.php
<?php
/**
* Application model for Cake.
*
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
*
* @link http://cakephp.org CakePHP(tm) Project
* @package app.Model
* @since CakePHP(tm) v 0.2.9
You can’t perform that action at this time.