Skip to content

Instantly share code, notes, and snippets.

glColor4ub(255, 0, 0, 255);
CGPoint vertices3[] = { ccp(100,100), ccp(200,100), ccp(200,200) };
fillTriangles(vertices3, 3);
// @interface MyLayer : Layer
- (BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView: [touch view]];
touchLocation = [[Director sharedDirector] convertCoordinate: touchLocation];
CGPoint location = ccp(touchLocation.x, touchLocation.y);
CGRect rect = CGRectMake(self.position.x - SIZE / 2, self.position.y - SIZE / 2, SIZE, SIZE);
#import <QuartzCore/QuartzCore.h>
- (UIImage*) buildImageFrom: (UIView*)view {
UIGraphicsBeginImageContext(view .bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
@interface MainScene : Scene {
ColorLayer* colorLayer_;
}
@property (nonatomic, retain) ColorLayer *colorLayer;
@end
@implementation MainScene
myStr = "2008" + "年";
myXList += <item>値1</item>;
myXML = <foo><bar>値1</bar></foo>;
myStr = myXML.bar;
delete myXML.bar;
;; for changelog memo
(setq user-full-name "akio0911")
(setq user-mail-address "[email protected]")
(defun memo ()
(interactive)
(add-change-log-entry
nil
(expand-file-name "~/Dropbox/changelog.txt")))
(define-key ctl-x-map "M" 'memo)
# git のブランチ名前を表示
_set_env_git_current_branch() {
GIT_CURRENT_BRANCH=$( git branch &> /dev/null | grep '^\*' | cut -b 3- )
}
_update_rprompt () {
if [ "`git ls-files 2>/dev/null`" ]; then
RPROMPT="[%~:$GIT_CURRENT_BRANCH]"
else
RPROMPT="[%~]"
for fname in *.m4a ; do
res=`expr $fname : "hogehoge_\(.*\)_"`
mv $fname fuga-0${res}.m4a;
done
<font>
</font>
@interface MentionViewController : UITableViewController
{
NSMutableArray *statuses;
}