Skip to content

Instantly share code, notes, and snippets.

View TAKAyukiatkwsk's full-sized avatar

Takayuki Takagi TAKAyukiatkwsk

View GitHub Profile
@TAKAyukiatkwsk
TAKAyukiatkwsk / ruby.snip
Last active December 12, 2015 10:39
Vim ruby snippet for me
snippet class
abbr class ... end
class ${1:#:ClassName}
${2:TARGET}
end
snippet defini
abbr def initialize(param) ... end
def initialize(${1:#:param})
${2:TARGET}
@TAKAyukiatkwsk
TAKAyukiatkwsk / current_monitor_resolution.awk
Created February 11, 2013 00:32
X window system使用時に現在の画面解像度を取得する
#!/usr/bin/awk
# Print current monitor resolution on WIDTHxHEIGHT style from xrandr
BEGIN {
FS = ","
}
{
for (i = 1; i <= NF; i++) {
# find current monitor resolution
if ($i ~ /^ current/) {
str_current = $i
@TAKAyukiatkwsk
TAKAyukiatkwsk / .zshrc.debian
Last active December 11, 2015 18:19
.zshrc for Debian
# ls settings
alias ls="ls -F --color"
# completion with colors
zstyle ':completion:*' list-colors 'di=01;34'
@TAKAyukiatkwsk
TAKAyukiatkwsk / .zshrc.osx
Created January 26, 2013 06:26
.zshrc for OS X
# ls colors
export LSCOLORS=ExFxxxxxBxxxxxxxxxxxxx
alias ls="ls -GF"
# completion with colors
zstyle ':completion:*' list-colors 'di=01;34:ln=01;35:ex=01;31'
@TAKAyukiatkwsk
TAKAyukiatkwsk / file.rb
Created January 22, 2013 01:52
Android app から投稿テスト
# test
これは github の android app から投稿しました。
@TAKAyukiatkwsk
TAKAyukiatkwsk / install_composer.sh
Created September 22, 2012 01:57
Install Composer
#!/bin/sh
curl -s https://getcomposer.org/installer | php
@TAKAyukiatkwsk
TAKAyukiatkwsk / numerals.rb
Last active June 21, 2022 01:28
数字を英語表記に変換する
#!/usr/local/bin/ruby
# ruby numerals.rb 1234
# => twelve hundred thirty-four
class Num2Eng
# 数字と英語を結びつける
NUM_ENG = {'0' => 'zero',
'1' => 'one',
'2' => 'two',
'3' => 'three',
@TAKAyukiatkwsk
TAKAyukiatkwsk / functions.php
Created May 28, 2012 07:48
WordPressサイトにはてなスターを設置する
<?php
function my_hatena_star_code() {
?>
<script type="text/javascript" src="http://s.hatena.ne.jp/js/HatenaStar.js"></script>
<script type="text/javascript">
Hatena.Star.SiteConfig = {
entryNodes: {
'article': {
uri: 'h1 a',
title: 'h1',
@TAKAyukiatkwsk
TAKAyukiatkwsk / hatena_bookmark.php
Created April 1, 2012 03:48
WordPressサイトにはてなブックマークを設置する
<a href="http://b.hatena.ne.jp/entry/<?php the_permalink(); ?>" class="hatena-bookmark-button" data-hatena-bookmark-title="<?php echo the_title_attribute( array( 'echo' => 0 ) ) . ' | ' . get_bloginfo( 'name' ); ?>" data-hatena-bookmark-layout="vertical" title="このエントリーをはてなブックマークに追加"><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="このエントリーをはてなブックマークに>追加" width="20" height="20" style="border: none;" /></a><script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>
@TAKAyukiatkwsk
TAKAyukiatkwsk / functions.php
Created March 31, 2012 13:06
WordPressサイトのOGP設定
<?php
function my_blog_description() {
$description = '';
if ( is_single() ) {
// 投稿の場合
$_post = get_post();
$description = $_post->post_content;
$description = preg_replace( "/[\n|\r|\n\r|\t|\s]/", '', $description );
$description = strip_tags( $description );
$more_str = mb_strlen( $description, 'UTF-8' ) > 100 ? '...' : '';