This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (self.attributedString != nil && [self.attributedString.string rangeOfString:@"これになる不思議"].location != NSNotFound) { | |
DNSLog(@"%@", self.attributedString); | |
UniChar *p = (UniChar*)malloc(sizeof(UniChar) * self.attributedString.string.length); | |
[self.attributedString.string getCharacters:p]; | |
FILE *fp = fopen("/Users/sonson/bug_data.bin", "wb"); | |
fwrite(p, sizeof(UniChar), self.attributedString.string.length, fp); | |
fclose(fp); | |
free(p); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
paths = [] | |
paths.push(ARGV[0] + "/**/*.h") | |
paths.push(ARGV[0] + "/**/*.m") | |
blacklist = ["/imobile/", "/nend/", "/Google/", "/Evernote/", "/admob/", "/TestFlight/", "/UICoderz/"] | |
lines = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { | |
// スワイプのジェスチャを開始するかを判定する | |
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { | |
UIPanGestureRecognizer *panGesture = (UIPanGestureRecognizer *)gestureRecognizer; | |
CGPoint velocity = [panGesture velocityInView:panGesture.view]; | |
double radian = atan(velocity.y/velocity.x); | |
double degree = radian * 180 / M_PI; | |
// 指定した角度よりも大きく(斜めに)スワイプした場合は,ジェスチャは開始されない |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is OK | |
NSString *temp = [NSString stringWithFormat:@"title BEGINSWITH %@", searchBar.text]; | |
NSPredicate *predicate = [NSPredicate predicateWithFormat:temp]; | |
// Bad... | |
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"title BEGINSWITH %@", searchBar.text]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GIT_MARKETING_VERSION=`git describe --abbrev=0 --tags` | |
GIT_REVISION=`git rev-parse --short HEAD` | |
GIT_COMMIT_TIMES_STRING=`git log --since=2000-01-01 --oneline --no-merges | wc -l` | |
let GIT_COMMIT_TIMES=GIT_COMMIT_TIMES_STRING+13000 | |
cat > ./2tch/info.prefix <<EOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'octokit' | |
api_div_html_text = <<"EOS" | |
<div class="toc"><ul><li><strong>API methods</strong><span class="mode-selector"><a class="mode mode-current" href="/dev/api">by section</a><a class="mode " href="/dev/api/oauth">by oauth scope</a></span><ul><li><a href="#section_account" class="section">account</a><ul><li class="supports-oauth"><a href="#GET_api_v1_me">/api/v1/me</a></li><li class="supports-oauth"><a href="#GET_api_v1_me_blocked">/api/v1/me/blocked</a></li><li class="supports-oauth"><a href="#GET_api_v1_me_friends">/api/v1/me/friends</a></li><li class="supports-oauth"><a href="#GET_api_v1_me_karma">/api/v1/me/karma</a></li><li class="supports-oauth"><a href="#GET_api_v1_me_prefs">/api/v1/me/prefs</a></li><li class="supports-oauth"><a href="#GET_api_v1_me_trophies">/api/v1/me/trophies</a></li><li class="supports-oauth"><a href="#GET_prefs_blocked">/prefs/blocked</a></li><li class="supports-oauth"><a href="#GET_prefs_friends">/prefs/friends</a></li><li class="supports-oauth"><a href="#GET_prefs_{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'octokit' | |
client = Octokit::Client.new(:access_token => "") | |
labels = [ | |
"account", | |
"captcha", | |
"flair", | |
"reddit gold", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# generate HttpStatus.swift from wikipedia | |
# for reddift project | |
# https://github.com/sonsongithub/reddift | |
# | |
# http://en.wikipedia.org/wiki/List_of_HTTP_status_codes | |
# | |
require 'net/http' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
func doit(value:Int) throws -> String { | |
if value > 0 { | |
return String(value) | |
} | |
else { | |
throw NSError(domain: "test.sonson.com", code: 0, userInfo: [:]) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
public enum Result<A> { | |
case Success(A) | |
case Failure(NSError) | |
public init(value:A) { | |
self = .Success(value) |