Skip to content

Instantly share code, notes, and snippets.

@app2641
app2641 / HttpStatusForPHPer.php
Created February 21, 2013 07:10
id:tokuhiromさんのエントリ(http://blog.64p.org/entry/2013/02/21/121830)に触発されて。 使い方は同じ。
#! /usr/bin/php
<?php
$StatusCode = array(
"100" => "Continue",
"101" => "Switching Protocols",
"102" => "Processing", # RFC 2518 (WebDAV)
"200" => "OK",
"201" => "Created",
"202" => "Accepted",
@app2641
app2641 / ggrks
Last active December 19, 2015 14:59
ggrksシェル。 引数に検索語句を入れて実行するとChromeでGoogle検索を行う。 AND検索も可。
#!/bin/bash
if [ $# == 0 ]; then
echo "引数に検索語句を指定してください"
exit 1
fi
q=`echo $@ | sed -e 's/ /+/g'`
open -a Google\ Chrome https://www.google.com/search?q=$q
@app2641
app2641 / file0.js
Created October 5, 2013 09:52
InfiniteGrid とFiltersFeature の併用バグの対策 ref: http://qiita.com/app2641/items/cc691ecd86c50932f488
Ext.override(Ext.data.Store, {
refetchPage: function(page, options, forceLoad) {
var me = this,
pageSize = me.pageSize || 200,
start = (page - 1) * me.pageSize,
end = start + pageSize;
if (me.getCount() === me.getTotalCount() && !forceLoad) {
return;
}
@app2641
app2641 / gist:7939572
Last active December 31, 2015 05:19
ChatWorkAPI GoogleAppsScript Sample
function getCalendarSchedule () {
var calendar = CalendarApp.getCalendarsByName('予定')[0],
events = calendar.getEventsForDay(new Date()),
schedule = '';
for (var i = 0; i < events.length; i++) {
schedule += events[i].getTitle() + '\n';
}
return schedule;
# prompt
export ZSH_THEME_GIT_PROMPT_DIRTY="%{%}% ✗"
export ZSH_THEME_GIT_PROMPT_CLEAN=""
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
DEFAULT=$'\U1F430 '
ERROR=$'\U1F363 '
export PS1="%{%}
@app2641
app2641 / pre-commit
Created February 21, 2017 01:33
.git/hooks/pre-commit
#! /bin/sh
git df --cached --name-only --diff-filter=AM | grep '\.rb$' | grep -v 'db/schema.rb' | xargs bundle exec rubocop -c .rubocop.yml
RUBOCOP=$?
git df --cached --name-only --diff-filter=AM | grep '\.js$' | xargs npm run lint
ESLINT=$?
if [ $RUBOCOP -eq $ESLINT ]; then
exit 0
else
alert('test');