Skip to content

Instantly share code, notes, and snippets.

View tocky's full-sized avatar

Shin Tokiwa tocky

  • ZEALOT Inc.
  • Tokyo, JAPAN
View GitHub Profile
@tocky
tocky / format_timetable.js
Created September 9, 2016 08:56
NAVITIME (https://www.navitime.co.jp) の路線バス時刻表をテキスト形式にフォーマットして console.log に出力するスニペットです。
/**
* NAVITIME (https://www.navitime.co.jp) の路線バス時刻表をテキスト形式にフォーマットして console.log に出力するスニペットです。
* このスクリプトは Pebble アプリの Time Table (http://www.sw-sandbox.info/) 用にフォーマットする目的で作られました。
*/
var time = '';
$('#d_1_0>.dl_0').each(function(i, dl){
var hour = $(dl).children('dt').text();
var mins = [];
$(dl).find('div:not([class])').each(function(j, div){

Untitled Slide

Welcome to Glide.

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

Publishing

@tocky
tocky / gist:5242377
Created March 26, 2013 01:25
Wordpress Media Library の画像をメタ情報とともに表示する方法
<!-- Refs: http://wordpress.org/support/topic/get-title-alt-or-caption-from-media-library-and-insert-into-theme -->
<?php
$args = array( 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'numberposts' => null, 'post_parent' => $post->ID );
$attachments = get_posts($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
$alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
$image_title = $attachment->post_title;
$caption = $attachment->post_excerpt;
@tocky
tocky / sublime-settings.json
Created November 22, 2012 10:45
Sublime Text 2 Settings
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
// ==================================================
// 基本設定
// ==================================================
// フォント
"font_face": "Monaco",
// フォントサイズ
"font_size": 13,
@tocky
tocky / install-java-on-ubuntu.md
Created November 20, 2012 09:14
Ubuntu 12.04 に Oracle Java をインストールする手順

Ubuntu 12.04 に Oracle Java をインストールする手順

add-apt-repository を利用するために python-software-properties を導入

sudo aptitude install python-software-properties

リポジトリを追加して Java をインストール

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

@tocky
tocky / TimezoneTest.java
Created May 22, 2012 01:19
タイムゾーンと日付フォーマットのテスト
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang.time.DateUtils;
/**
@tocky
tocky / fizzbuzz.coffee
Created March 14, 2012 02:18
FizzBuzz One-Liner by CoffeeScript (without "if-else" statement)
fizzbuzz = (x) -> console.log (i % 3 is 0 and i % 5 is 0 and "fizzbuzz" or i % 3 is 0 and "fizz" or i % 5 is 0 and "buzz" or i) for i in [1..x]
@tocky
tocky / Gemfile
Created September 21, 2011 01:14
Gemfile Snippet
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'omniauth'
gem 'haml-rails'