Skip to content

Instantly share code, notes, and snippets.

View pineoc's full-sized avatar
😇

Allen Yunseok Lee pineoc

😇
View GitHub Profile
bool HelloWorld::init()
{
/*has some code*/
//CC_CALLBACK_0 function
auto sprite1 = Sprite::create("CloseNormal.png");
auto callback = CCCallFunc::create(CC_CALLBACK_0(HelloWorld::myFunction1, this));
sprite1->runAction(callback);
this->addChild(sprite1);
void HelloWorld::registerControllerListener()
{
//create an evnetListenerController
_listener = EventListenerController::create();
//bind onConneected event call function
_listener->onConnected = CC_CALLBACK_2(HelloWorld::onConnectController,this);
//bind disconnect event call function
_listener->onDisconnected = CC_CALLBACK_2(HelloWorld::onDisconnectedController,this);
bool HelloWorld::init()
{
/*has some code*/
//sprite
auto sprite = Sprite::create("CloseNormal.png");
this->addChild(sprite1);
//sprite change, setTexture
sprite->setTexture(Director::getInstance()->getTextureCache()->addImage("CloseNormal_changed.png"));
}
cordova.exec(
function(freeSpace) {
//return freeSpace 'KB'
alert('reported free space is ' + freeSpace / 1024 + 'MB');
},
function() {
alert('failed');
},
"File", "getFreeDiskSpace", []
);
document.addEventListener("deviceready", checkConnection, false);
function checkConnection() {
function check(){
var networkState = navigator.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
var apnRequestFunc = function(dataArr, callback){
//dataArr
/*
["key1", "key2", "key3"]
*/
var apnConnection = new apn.Connection({
gateway : "gateway.sandbox.push.apple.com",
cert: __dirname + '/../../keys/cert.pem',
key: __dirname + '/../../keys/key.pem',
production: false
@pineoc
pineoc / https-server-bin-www.js
Created February 1, 2016 08:01
make https server using expressjs v4
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('logstash_test:server');
var http = require('http');
@pineoc
pineoc / bookstore.html
Created March 29, 2016 07:21
Cordova + jQuery mobile fixed navbar multi page
<div data-role="page" class="ui-page ui-body-c ui-page-header-fixed ui-page-footer-fixed" tabindex="0">
<div data-role="header" id="header" data-position="fixed">
<img id="head_title" src="img/head_title.png" />
</div>
<div data-role="content">
<!-- table for books (book case) -->
<table style="width:100%" id="bookcase"></table>
</div>
<!-- subscribe btn -->
<div data-role="footer" data-id="foo1" data-position="fixed">
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' href='/stylesheets/style.css' />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
<%= title %> 부트스트랩 101 템플릿</title>
@pineoc
pineoc / AppActivity.java
Created April 21, 2016 06:46
Cocos2d-x back button twice click exit
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal