Skip to content

Instantly share code, notes, and snippets.

Avatar

mikesorae mikesorae

View GitHub Profile
@mikesorae
mikesorae / hankaku.rb
Created Mar 16, 2014
全角カナ→半角カナ
View hankaku.rb
require 'nkf'
# 既存の半角は維持しつつ全角カナを半角に変換
ARGF.each do |line|
# -xを付けないと既存の半角カナが全角になるぽい
puts NKF.nkf('-xw -Z4', line)
end
@mikesorae
mikesorae / 0_reuse_code.js
Created Apr 28, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mikesorae
mikesorae / gist:bb39082f080c64445e37
Last active Aug 29, 2015
install anyenv system-widely
View gist:bb39082f080c64445e37
#!/bin/bash
cd /usr/local
git clone https://github.com/riywo/anyenv .anyenv
echo 'export PATH="/usr/local/.anyenv/bin:$PATH"' >> /etc/profile
echo 'export ANYENV_ROOT="/usr/local/.anyenv"' >> /etc/profile
echo 'eval "$(anyenv init -)"' >> /etc/profile
exec $SHELL -l
@mikesorae
mikesorae / prepare_nginx_app.sh
Created Jun 27, 2014
prepare new user and config file for nginx
View prepare_nginx_app.sh
#!/bash/bin
if [ $# != 2 ]; then
echo "usage: $0 app_name app_port" 1>&2
exit 0
fi
app_name=$1
port=$2
@mikesorae
mikesorae / prepar_apache_app.sh
Created Jun 30, 2014
prepare new user and config file for apache
View prepar_apache_app.sh
#!/bash/bin
if [ $# != 2 ]; then
echo "usage: $0 app_name app_port" 1>&2
exit 0
fi
app_name=$1
port=$2
@mikesorae
mikesorae / output_json.rb
Created Jul 2, 2014
to_json excluding unneeded column with nested object
View output_json.rb
puts c1.to_json(except: [:created_at, :updated_at], include: {items: {except: [:created_at, :updated_at]}})
@mikesorae
mikesorae / redmine_custom_subject.patch
Last active Aug 29, 2015
this is the patch for redmine to display custom_subject in the gantt chart.
View redmine_custom_subject.patch
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 62c6fbb..2467a66 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -74,7 +74,12 @@ module ApplicationHelper
if options[:subject] == false
title = issue.subject.truncate(60)
else
- subject = issue.subject
+ if options[:use_custom_subject]
@mikesorae
mikesorae / build.gradle
Last active Aug 29, 2015
gradle build script for xcode project
View build.gradle
//-------------------------------
// load default config file
//-------------------------------
def default_env_conf_url = file("default.gradle").toURL()
def config = new ConfigSlurper().parse(default_env_conf_url)
// load environment config file
if (hasProperty('env')) {
def env_config_url = file("${env}.gradle").toURL()
@mikesorae
mikesorae / install_sdk.sh
Last active Aug 29, 2015
install android sdk from cui
View install_sdk.sh
# install "Android SDK Build-tools, revision 19.1"
# filtered by target
echo y | android update sdk -u -a -t ${target_name}
# target_name can take following values
#
# tools
# platform-tools
# build-tools-20.0.0
@mikesorae
mikesorae / gist:b499e207a8cd29a9a00f
Created Sep 5, 2014
add ip address to docker container with pipework
View gist:b499e207a8cd29a9a00f
sudo /var/lib/pipework/pipework $BRIDGE_NAME $CONTAINER_ID $IP_ADDR/24
sudo ip addr add $IP_ADDR/24 dev $BRIDGE_NAME