Skip to content

Instantly share code, notes, and snippets.

View DriftwoodJP's full-sized avatar

DriftwoodJP DriftwoodJP

View GitHub Profile
@DriftwoodJP
DriftwoodJP / array-to-texttable.php
Last active December 20, 2015 05:29 — forked from Thingmand/array-to-texttable.php
PHP: Array to Text Table Generation Class Japanese Multibyte
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <tony@tonylandis.com>
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class ArrayToTextTable
@DriftwoodJP
DriftwoodJP / rename_wp_login.rb
Last active December 22, 2015 02:19
wp-login.php をリネームするスクリプト。
# 初期設定
dir = '/home/<your_id>/public_html/www/<your_wp_dir>/'
filename = 'wp-login.php'
size = 12
original_file = dir + filename
# 指定されたディレクトリに、指定されたファイルがあるか探す
if File.exist?(original_file)
# あれば リネームする
rename = [*1..9, *'A'..'Z', *'a'..'z'].sample(size).join + '_'
@DriftwoodJP
DriftwoodJP / README.md
Last active December 23, 2015 21:09
Vagrant: ドットインストールの開発環境構築レッスンをベースにWordPress環境をProvisioningしてみた | http://www.d-wood.com/blog/2013/09/26_4711.html
@DriftwoodJP
DriftwoodJP / 0_reuse_code.js
Created December 27, 2013 09:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@DriftwoodJP
DriftwoodJP / wp_research.rb
Last active January 3, 2016 20:39
WordPress: shortcode が含まれたエントリをリストアップする | http://www.d-wood.com/blog/2014/01/21_5319.html
require 'mysql'
require 'inifile'
# 設定
mycnf = IniFile.load('/home/****/.my.cnf')['client']
sqls = {
default: "SELECT id FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' AND post_content LIKE '%[short-code%';"
}
# Make sure using latest Homebrew
update
# Update already-installed formula
upgrade
# Add Repository
# tap homebrew/versions
# tap homebrew/binary
# 少し凝った zshrc
########################################
# 環境変数
export LANG=ja_JP.UTF-8
# 色を使用出来るようにする
autoload -Uz colors
colors
@DriftwoodJP
DriftwoodJP / backlog.rb
Last active August 29, 2015 14:01
Backlog API に ruby スクリプトから接続する | http://www.d-wood.com/blog/2014/05/12_6190.html
require 'xmlrpc/client'
require 'pp'
#
# Backlog の設定情報
#
# Backlog URI のサーバー名
SPACE = 'スペース名'
@DriftwoodJP
DriftwoodJP / argv_cmd.rb
Created May 15, 2014 07:30
ruby で ARGV をうけるコマンドっぽいものを作ってみる | http://www.d-wood.com/blog/2014/05/15_6221.html
#!/usr/bin/ruby
require 'optparse'
# default options
USER = 'Tom'
PASSWORD = 'tomtom'
SERVER = 'localhost'
OPTS = {}
@DriftwoodJP
DriftwoodJP / bingo_machine.rb
Created August 19, 2014 12:01
Mac に数字を読み上げてもらうビンゴ抽選器をつくる | http://www.d-wood.com/blog/2014/08/22_6662.html
require 'readline'
def notification(message, title='Bingo Machine', subtitle='', sound='Glass')
[message, title, subtitle, sound].each{|arg| arg.gsub!(/"/, '\\\\\"')}
scpt = 'display notification "%s"' % message
scpt << ' with title "%s"' % title
scpt << ' subtitle "%s"' % subtitle unless subtitle.empty?
scpt << ' sound name "%s"' % sound unless sound.empty?