Skip to content

Instantly share code, notes, and snippets.

@akisute
akisute / UILabel+AKiOS6Compatibility.m
Created October 2, 2014 08:24
You will no longer be suffered by iOS 6 Hiragino fonts.
- (NSString *)text6Compatible
{
return self.text;
}
- (void)setText6Compatible:(NSString *)text6Compatible
{
self.text = text6Compatible;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(7)) {
@akisute
akisute / MyPlayground.swift
Last active August 29, 2015 14:02
Playing around with Swift
import Foundation
var l = [
"abesi",
"hidebu",
"tawaba",
]
var m = [
"abesi": 1,
@stevendborrelli
stevendborrelli / boot2docker.json
Last active December 31, 2015 02:08
Packer.io json template for boot2docker
{
"builders": [{
"type": "virtualbox",
"guest_os_type": "Linux",
"iso_url": "https://github.com/steeve/boot2docker/releases/download/v0.3.0/boot2docker.iso",
"iso_checksum": "e03670ed349c54848e20d9043a90f2df8df70d82e674b84a7083301193745b19",
"iso_checksum_type": "sha256",
"ssh_username": "docker",
"ssh_password": "tcuser",
"shutdown_command": "sudo poweroff"
@yyaammaa
yyaammaa / gist:7480613
Last active June 30, 2017 02:50
Butter Knifeの紹介

Butter Knifeの紹介

Android用のView Injectionライブラリである Butter Knife について解説します (といいますか、サイトに書いてあることをほとんどそのまま日本語にしただけです) 。

概要

Butter Knifeは ActionBarSherlock などでお馴染みの Square のJake WhartonさんによるAndroid用のView Injectionライブラリです。

使い方

このライブラリの目的が、

  • Activity, ViewのfindViewByIdを楽に書く
@frsyuki
frsyuki / mysql-usec.md
Last active October 8, 2020 01:02
Getting current time in microseconds in MySQL < 5.6

MySQL 5.5 で現在時刻をマイクロ秒の精度で取得する方法

画期的な方法を発見した。MySQL 5.5 の UUID() 関数は、100ナノ秒精度の現在時刻を含んだ UUID v1 を返す(12.15. Miscellaneous Functions)。これをパースすればマイクロ秒精度の現在時刻を取得することができる。

詳しい実装についてはmysqldのソースに書いてあるので読めばいい。mysql-5.5.27/sql/item_strfunc.cc に実装してある。141427日間のオフセットがかかっていたりするので気をつける。

DELIMITER //
CREATE FUNCTION TIMESTAMP_USEC()
RETURNS BIGINT NOT DETERMINISTIC
@repeatedly
repeatedly / msgpack_issue_121.md
Last active November 30, 2021 02:09
MessagePackが文字列とバイナリをわけないのは問題?

MessagePackが文字列とバイナリをわけないのは問題?

msgpack/msgpack#121

Objective Cの実装使ってるとある問題にぶちあたった.なので,文字列をちゃんとバイナリ(Raw)と分けるべき,という提案

(*) 俺は熟読したわけではないので,中身が気になる人はちゃんと本スレを読みましょう

そもそもMessagePackとは

@arosh
arosh / Gemfile
Created August 29, 2012 09:54
activerecord with sqlite3, another primary key
source :rubygems
# activerecordにはパッケージ名に罠がある
# http://stackoverflow.com/questions/4016929/bunder-require-does-not-work-for-activerecord-in-my-gem
gem 'activerecord', require: 'active_record'
gem 'sqlite3'
@gereon
gereon / gist:3150445
Created July 20, 2012 12:20
Mac OSX Spotlight Enhancement

Mac OSX Spotlight Enhancement

Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
public.c-plus-plus-source
@erukiti
erukiti / in_tail_mysql.rb
Created July 16, 2012 09:12
Fluent-plugin-tail-mysql
# coding: utf-8
class Fluent::InTailMysql < Fluent::Input
Fluent::Plugin.register_input('tail_mysql', self)
require 'mysql'
config_param :host, :string
config_param :user, :string
config_param :password, :string