Skip to content

Instantly share code, notes, and snippets.

View amachang's full-sized avatar

Hitoshi Amano amachang

View GitHub Profile
@amachang
amachang / jQuery hashchange test
Created February 20, 2012 10:06
jQuery hashchange test
var host = location.host;
var protocol = location.protocol;
$(function() {
$(window).hashchange(function() {
// ここらへんで、現在の状態を location.hash から引けるように保存する。
// 次に、 location.hash から依然に保存されたものがあれば、取得する(リフレッシュするかも)
$('title').text(location.hash);
$('#log').text($('#log').text() + 'push ' + location.hash + "\n");
@amachang
amachang / gist:1990500
Created March 7, 2012 02:28
TCP Streaming for iOS
#import <UIKit/UIKit.h>
@interface TESTStreamDelegate : NSObject <NSStreamDelegate>
@property (strong, nonatomic) NSInputStream *inputStream;
@property (strong, nonatomic) NSOutputStream *outputStream;
- (void) request;
@end
@amachang
amachang / gist:2019501
Created March 12, 2012 03:18
How to debug Retain Count and Autorelease Count on Objective-C
+ (NSString*) stringEncodedPercentWithString:(NSString*)source
{
NSString *encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)source, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8);
[encodedString autorelease];
// Show target's memory address.
NSLog(@"encodedString address = 0x%p", encodedString);
// Show target's autorelease count
[NSAutoReleasePool showPools];
@amachang
amachang / gist:2935689
Created June 15, 2012 09:55
最低限の作業用セットアップ
sudo apt-get -y install ack-grep vim
cat << BASH_ALIASES_EOS > ~/.bash_aliases 2>&1
alias ack=ack-grep
BASH_ALIASES_EOS
cat << VIMRC_EOS > ~/.vimrc 2>&1
syntax on
set number
set expandtab
@amachang
amachang / send_sms.php
Created November 12, 2012 01:54
Send SMS through Skype with php-dbus; pecl library.
<?php
$phoneNumber = '+818012345678';
$dbus = new DBus();
$n = $dbus->createProxy('com.Skype.API', '/com/Skype', 'com.Skype.API');
if ($n->Invoke('NAME test') !== 'OK') die();
if ($n->Invoke('PROTOCOL 7') !== 'PROTOCOL 7') die();
@amachang
amachang / skype.conf
Created November 12, 2012 02:04
Ubuntu Upstart Script for Skype
# Set up xvfb.conf like https://gist.github.com/1934754
# as a prerequisite for this configuration.
description "Skype"
start on (net-device-up
and local-filesystems
and started dbus
and started xvfb
and runlevel [2345])
@amachang
amachang / gist:4670781
Created January 30, 2013 05:02
こんな感じ
syntax on
set number
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=0
set smartindent

既存のプログラミング学習方法とガルこれの比較

| 動画 | セミナー | 書籍 | 仕事としてやる | ガルこれ --- | --- | --- | --- | --- | --- とっつきやすさ | ○ | × | × | ○ | △ 最初の一行を書くまでの敷居が低いか | △ | ○ *1 | × | ○ | ○ 文法や基本的な関数の習得に向いているか | × *2 | ○ | × | ○ | ○ モチベーションを保ちやすいか | △ | ○ | × | ○ | ○ プログラミング以外のことを学べるか
(デザイン、ディレクション、マネジメント、テストの仕方、ライブラリのこと、などなど) | △ | ○ | ○ | ○ | × お金がかからない | ○ | × | △ | ○ *3 | ○

contents of foo
contents of bar