Skip to content

Instantly share code, notes, and snippets.

@takafumir
takafumir / 404.php
Created February 25, 2015 03:27
404 not found page template for wordpress. (MIT License)
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title>お探しのページが見つかりませんでした</title>
<?php get_template_part( 'analytics' ); // create analytics.php template file or delete this line. ?>
</head>
<body>
<div>
@takafumir
takafumir / blog_search_bookmarklet.js
Created April 21, 2015 02:56
Google Blog Search Bookmarklet
javascript:var%20url=location.href;var%20word=url.match(/(#q=|search\?q=|&q=)(.*?)($|&)/)[2];var%20subw=window.open('https://www.google.co.jp/webhp?tbm=blg#tbm=blg&q='+word).document;
@takafumir
takafumir / Regexp.swift
Last active June 16, 2016 02:43
Swift utility class for regular expression
import Foundation
class Regexp {
let internalRegexp: NSRegularExpression
let pattern: String
init(_ pattern: String) {
self.pattern = pattern
var error: NSError?
self.internalRegexp = NSRegularExpression( pattern: pattern, options: NSRegularExpressionOptions.CaseInsensitive, error: &error)!
@takafumir
takafumir / create_todo_formated_file.rb
Last active December 28, 2016 05:37
Create a todo formated file for this year. Ref. http://easyramble.com/how-to-manage-tasks-simply.html
#!/usr/bin/env ruby
require "date"
def this_year
( ARGV[0] || DateTime.now.year ).to_i
end
def leap_year?
Date.new(this_year).leap?
@takafumir
takafumir / gitignore-for-swift
Last active December 15, 2020 15:57
.gitignore for Swift / originally based on `gibo swift` and added some other settings.
### https://raw.github.com/github/gitignore/2f7c4e80629d1b02c9e1bce9fc54628ed620d2d6/swift.gitignore
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
@takafumir
takafumir / Bookmarklet for Yahoo finance economic indicators
Last active June 1, 2021 01:08
Yahooファイナンスの経済指標を1営業日前から表示するブックマークレット(土日対応、祝日は非対応)
javascript:var now = new Date(); var day_offset = 1; if (now.getDay() === 1) { day_offset = 3 }; var yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - day_offset); var prev_date = String(yesterday.getFullYear()) + String(('0' + (yesterday.getMonth() + 1)).slice(-2)) + String(('0' + yesterday.getDate()).slice(-2)); var url = `https://info.finance.yahoo.co.jp/fx/marketcalendar/?d=${prev_date}&c=ALL&i=0`; window.location.href = url;
@takafumir
takafumir / twitpic_downloader.rb
Last active October 20, 2023 01:00
Twitpic downloader with Ruby
# Twitpic downloader with Ruby
#
# This tool enables you to save all your twitpic full-size images.
# Confirmed this tool working with Ruby 2.1.2.
#
# Usage
# $ mkdir work_dir
# $ ruby twitpic_downloader.rb user_name work_dir
#
# MIT License