Skip to content

Instantly share code, notes, and snippets.

@edom18
edom18 / GAS.js
Created January 19, 2014 12:44
Google Apps Scriptを使って簡易APIをサクッと作る ref: http://qiita.com/edo_m18/items/0519d241ac7683815a53
function doGet(e) {
return makeContent(makeResponse(e, "GET"));
}
function doPost(e) {
return makeContent ( makeResponse(e,"POST"));
}
function checkId(id) {
var ss = SpreadsheetApp.openById('0ArR-uXirGVyWdFJ1WFZyclpMRzA5dmhnaVMxa29zNlE');
@edom18
edom18 / rename.py
Created January 19, 2014 13:36
This script is for Blender. Rename objects, meshes, bones and materials' name.
import bpy
for obj in bpy.data.objects:
obj.name = 'replaceObjectName'
for mesh in bpy.data.meshes:
mesh.name = 'replaceMeshName'
for armature in bpy.data.armatures:
armature.name = 'replaceArmatureName'
@edom18
edom18 / 0_reuse_code.js
Created January 21, 2014 14:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
- (NSURL *)applicationDocumentsDirectory
{
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
return url;
}
@edom18
edom18 / EntityMigrationPolicySample.m
Created February 5, 2014 12:07
CoreDataのマイグレーションをしようとしたときのメモ(未解決あり) ref: http://qiita.com/edo_m18/items/717fe32d744a10df7179
- (BOOL)createDestinationInstancesForSourceInstance:(NSManagedObject *)sInstance entityMapping:(NSEntityMapping *)mapping manager:(NSMigrationManager *)manager error:(NSError **)error
{
NSManagedObjectContext *context = [manager destinationContext];
NSString *entityName [mapping destinationEntityName];
NSManagedObject *dInstance = [NSEntityDescription insertNewObjectForEntityForName:entityName inManagedObjectContext:context];
[dInstance setValue:@"value1" forKey:@"anyKey1"];
[dInstance setValue:@"value2" forKey:@"anyKey2"];
//…
//レイヤーを新規作成
CALayer *sublayer = [CALayer layer];
sublayer.backgroundColor = [UIColor blueColor].CGColor;
sublayer.shadowOffset = CGSizeMake(0, 3);
sublayer.shadowRadius = 5.0;
sublayer.shadowColor = [UIColor blackColor].CGColor;
sublayer.shadowOpacity = 0.8;
sublayer.frame = CGRectMake(30, 30, 120, 150);
sublayer.borderColor = [UIColor blackColor].CGColor;
sublayer.borderWidth = 2.0;
@edom18
edom18 / file0.m
Created February 23, 2014 16:10
[Objective-C] AVCaptureとvImageを使ってリアルタイムフィルタを作ってみる ref: http://qiita.com/edo_m18/items/727bee5affe6e36d77c2
#import <Accelerate/Accelerate.h>
#import <AVFoundation/AVFoundation.h>
@edom18
edom18 / file0.m
Last active October 18, 2015 19:04
カスタムContainer View Controllerを作る ref: http://qiita.com/edo_m18/items/8b6b457f82b185ab1f6a
- (void)displayContentController:(UIViewController *)content
{
// 自身のビューコントローラ階層に追加
// 自動的に子ViewControllerの`willMoveToParentViewController:`メソッドが呼ばれる
[self addChildViewController:content];
// 子ViewControllerの`view`を自身の`view`階層に追加
[self.view addSubview:content.view];
// 子ViewControllerに追加が終わったことを通知する
@edom18
edom18 / file0.m
Created February 27, 2014 01:57
[Objective-C] Blocksがややこいのでまとめてみる ref: http://qiita.com/edo_m18/items/a1ee24cd23d3adde51d8
void (^blk)(void) { NSLog(@"in block"); };
@edom18
edom18 / file0.m
Created March 1, 2014 14:18
[Objective-C] フリップアニメーションでビューを切り替える ref: http://qiita.com/edo_m18/items/45fcbc67154eb68ef469
UIView *view1 = [[UIView alloc] initWithFrame:self.view.bounds];
view1.backgroundColor = [UIColor redColor];
UIView *view2 = [[UIView alloc] initWithFrame:self.view.bounds];
view2.backgroundColor = [UIColor blueColor];
[self.view addSubview:view1];
[self.view addSubview:view2];
// 追加と同時に行うとアニメーションしないので、サンプルでは処理をちょっとだけ遅延させています