Skip to content

Instantly share code, notes, and snippets.

View 7gano's full-sized avatar

Norihisa Nagano 7gano

View GitHub Profile
var canvas = document.createElement('canvas');
canvas.width = 768;
canvas.height = 1024;
document.body.appendChild(canvas);
var context = canvas.getContext('2d');
context.fillStyle = 'red';
context.fillRect(100,100,100,100);
@7gano
7gano / gist:6434031
Created September 4, 2013 08:00
double tap!
UITapGestureRecognizer *doubleTapGestureRecognizer;
doubleTapGestureRecognizer = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(_doubleTapAction:)];
doubleTapGestureRecognizer.numberOfTapsRequired = 2;
[cell addGestureRecognizer:doubleTapGestureRecognizer];
UITapGestureRecognizer *singleTapGestureRecognizer;
singleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_singleTapAction:)];
singleTapGestureRecognizer.numberOfTapsRequired = 1;
[singleTapGestureRecognizer requireGestureRecognizerToFail:doubleTapGestureRecognizer];
var MOON = require('phantoMOON');
var directory = '90PC2AlZ1375836774851';
MOON.setCurrentPage(directory);
var page = MOON.getCurrentPage();
var backing = page.backing;
console.log(backing);
var paperJSON = MOON.getPaperJSON(backing);
console.log(paperJSON);
var fs = require("fs");
var _currentBacking;
exports.setCurrentPage = function(backing){
_currentBacking = backing;
};
exports.getCurrentPage = function(){
var path = './' + _currentBacking + '/info.json';
var f = function(){
var core = new Core(320,
320
);
core.onload = function(){
var sprite = new Sprite(32, 32);
sprite.x = 100;
sprite.y = 100;
sprite.backgroundColor = 'blue';
sprite.tl.moveTo(768 * 0.5 - 32,
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
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));
}
};
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() {
/*
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,
//クラス(すべて)に追加
[UIView insertPreprocessToSelector:@selector(method:)
block:
^{
NSLog(@"YES");
}];
//このインスタンスだけに追加
[view insertPreprocessToSelector:@selector(method:)