Skip to content

Instantly share code, notes, and snippets.

View 7gano's full-sized avatar

Norihisa Nagano 7gano

View GitHub Profile
@7gano
7gano / makeObjectsPerformSelector.m
Last active September 27, 2015 05:47
makeObjectsPerformSelector
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
@autoreleasepool {
UIView* superView = [[UIView alloc] initWithFrame:CGRectZero];
for(int i = 0; i < 10; i++){
UIView* view = [[UIView alloc] initWithFrame:CGRectZero];
[superView addSubview:view];
@7gano
7gano / viewController.m
Created October 20, 2011 11:52
CAKeyframeAnimation.rotationMode
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
[self action];
}
- (void)action
{
//Create Content Layer
@7gano
7gano / gist:3771084
Created September 23, 2012 13:46
kAudioUnitSubType_AudioFilePlayer
#import <AudioToolbox/AudioToolbox.h>
- (void)play
{
AUGraph _AUGraph;
OSStatus err;
AudioUnit remoteIOUnit;
AudioUnit audioPlayerUnit;
AUNode audioPlayerNode, remoteOutputNode;
@7gano
7gano / gist:5195650
Last active December 15, 2015 03:39
#include <CoreFoundation/CoreFoundation.h>
int main(int argc, const char * argv[])
{
CFShow(CFSTR("Hello, Core Foundation!\n"));
return 0;
}
@7gano
7gano / gist:5231806
Last active December 15, 2015 08:38
#include <CoreFoundation/CoreFoundation.h>
int main(int argc, const char * argv[])
{
CFStringRef stringRef;
stringRef = CFSTR("Hello, World!\n");
CFStringRef fruits[] = {CFSTR("Apple"), CFSTR("banana")};
CFArrayRef arrayRef;
arrayRef = CFArrayCreate(kCFAllocatorDefault,
@7gano
7gano / gist:5238239
Last active December 15, 2015 09:29
#include <CoreFoundation/CoreFoundation.h>
int main(int argc, const char * argv[])
{
CFStringRef string;
string = CFStringCreateWithCString(kCFAllocatorDefault,
"Core Foundation",
kCFStringEncodingUTF8);
printf("%ld\n",CFGetRetainCount(string));
//クラス(すべて)に追加
[UIView insertPreprocessToSelector:@selector(method:)
block:
^{
NSLog(@"YES");
}];
//このインスタンスだけに追加
[view insertPreprocessToSelector:@selector(method:)
/*
Simple CFAllocator example program, demonstrating creation and use of custom CFAllocators.
Author: Ali Ozer
7/7/99
Copyright (c) 1999-2004, Apple Computer, Inc., all rights reserved.
*/
/*
IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
consideration of your agreement to the following terms, and your use, installation,
importJS(["lib/MOON.js", "lib/enchant.js", "lib/ui.enchant.js", "lib/color.enchant.js",
"lib/stylus.enchant.js", "lib/puppet.enchant.js", "lib/moon.puppet.enchant.js"],
function() {
enchant();
var sticker = Sticker.create();
sticker.onattach = sticker.ondetach = function() {
MOON.finish();
};
sticker.ontap = function() {
var evalRemoteCode = function(){
var xhr = new XMLHttpRequest();
xhr.open('GET', BASE_URL + '/code', true);
xhr.onreadystatechange = function(){
if(xhr.readyState === 4){
var code = xhr.response;
console.log('got code:' + code);
console.log(eval(code));
}
};