Skip to content

Instantly share code, notes, and snippets.

View yamaya's full-sized avatar

Masayuki Yamaya yamaya

  • Sapporo, Hokkaido, Japan
View GitHub Profile
@meleyal
meleyal / macvim-padding
Created February 24, 2012 18:42
Add padding to MacVim windows
defaults write org.vim.MacVim MMTextInsetTop '10'
defaults write org.vim.MacVim MMTextInsetLeft '10'
defaults write org.vim.MacVim MMTextInsetBottom '10'
defaults write org.vim.MacVim MMTextInsetRight '10'
@codeswimmer
codeswimmer / ios_coreanimation_eggs.m
Created January 7, 2012 20:44
iOS: Core Animation Example: eggs falling out of a tree
// Core Animation Example: eggs falling out of a tree
// This was glommed from iphonedevsdk: http://www.iphonedevsdk.com/forum/iphone-sdk-development/65632-animation-sample-code-our-newest-app.html
// This is the main animation routine.
- (IBAction) doorEasterEggAction;
{
//treeDoorImageView
CATransform3D theTransform;
UIImageView* anEgg;
@aki-null
aki-null / gist:1497649
Created December 19, 2011 15:23
Core Text APIを使用した際に起こる行間の問題の回避
NSFont *normalFont = [NSFont systemFontOfSize:12];
CGRect renderFrame = CGRectMake(0, 0, 300, 50); // box to render the text into
static NSLayoutManager *layMan = nil;
if (!layMan) {
layMan = [NSLayoutManager new];
}
CGFloat lineHeight = [layMan defaultLineHeightForFont:normalFont]; // calculate the expected height of a line
NSDictionary *attrDict = [NSDictionary dictionaryWithObject:normalFont andKey:NSFontAttributeName];
"""
""" quickrun.vim
"""
" コンフィグを全クリア
let g:quickrun_config = {}
" 横分割をするようにする
let g:quickrun_config['*'] = {'split': ''}
@kovyrin
kovyrin / rb-gsl.patch
Created September 14, 2011 22:22
Fix for "matrix_complex.c:1525: error: conflicting types for ‘gsl_matrix_complex_equal’"
diff --git a/ext/matrix_complex.c b/ext/matrix_complex.c
index 8a77ac1..1b1d8af 100644
--- a/ext/matrix_complex.c
+++ b/ext/matrix_complex.c
@@ -1519,8 +1519,7 @@ static VALUE rb_gsl_matrix_complex_indgen_singleton(int argc, VALUE *argv, VALUE
return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, mnew);
}
-
-static int gsl_matrix_complex_equal(const gsl_matrix_complex *m1,
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@mads-hartmann
mads-hartmann / Coffeescript ctags
Created April 7, 2011 07:44
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*->.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
@j0sh
j0sh / Makefile
Created March 31, 2011 07:05
iOS static library cross-compile script.
# iOS builds for ARMv7 and simulator i386.
# Assumes any dependencies are in a local folder called libs and
# headers in a local folder called headers.
# Dependencies should already have been compiled for the target arch.
PROJ=untitled
ifeq ($(IOS), 1)
ARCH=armv7
DEVICE=OS
CC_FLAGS=-arch $(ARCH)
- (void)scan {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
ALAssetsGroupType sources = ALAssetsGroupLibrary | ALAssetsGroupSavedPhotos;
NSMutableArray *tags = [[NSMutableArray alloc] init];
ALAssetsGroupEnumerationResultsBlock assetsEnumerator = ^(ALAsset *result, NSUInteger index, BOOL *stop){
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (result) {
if ([[result valueForProperty:ALAssetPropertyType] isEqual:ALAssetTypePhoto]) {
@koyachi
koyachi / gist:765964
Created January 5, 2011 05:13
ビルドオプション毎(アクティブな構成, ターゲット, architecture等)にバージョン情報を変える
XCodeの'グループとファイル'画面でターゲット選択、新規ビルドフェーズ(新規スクリプト)を追加
スクリプトフェーズを最初に持ってくる('バンドルリソースをコピー'の前に持ってくる)
YourProject-Info.plistにVersionValueとVersionValueForDisplayキーを追加。VersionValueに\d+.\d+.\d+な文字列を入れる
スクリプトに以下を書く
VERSION=`cat ./YourProject-Info.plist | tr -d '\n\t' | perl -nle 'print ($_ =~ /^.*?<key>VersionValue<\/key><string>(\d+\.\d+\.\d+)<\/string>.*$/) ? $1 : ""'`
VERSION_FOR_DISPLAY=$VERSION-$CONFIGURATION-$ARCHS
/usr/libexec/PlistBuddy -c "Set :VersionValueForDisplay $VERSION_FOR_DISPLAY" ./YourProject-Info.plist