Skip to content

Instantly share code, notes, and snippets.

View wonkwh's full-sized avatar
💭
I may be slow to respond.

wonkwh wonkwh

💭
I may be slow to respond.
View GitHub Profile
@wonkwh
wonkwh / ScaleFadePageTransformer.java
Created December 11, 2012 05:15 — forked from jgilfelt/ScaleFadePageTransformer.java
An ICS+ app/widget drawer style PageTransformer for your ViewPager
/***
* Copyright (c) 2012 readyState Software Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<!--
A button bar is a set of buttons at the bottom of an activity.
An example is an AlertDialog with OK/Cancel buttons.
Note that something similar can be accomplished using a
split action bar and text-only action buttons, but this is an
alternate presentation that's often preferred.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
import android.view.MotionEvent;
import org.cocos2d.actions.base.CCRepeatForever;
import org.cocos2d.actions.instant.CCCallFunc;
import org.cocos2d.actions.interval.CCAnimate;
import org.cocos2d.actions.interval.CCMoveTo;
import org.cocos2d.actions.interval.CCSequence;
import org.cocos2d.events.CCTouchDispatcher;
import org.cocos2d.layers.CCLayer;
@wonkwh
wonkwh / Random.cpp
Last active December 14, 2015 04:39
random number generator class in c++
// http://www.cocos2d-x.org/boards/6/topics/23093
//Hi, I'm using this class for generating random numbers since our app has multiplayer support on all platforms and consistent pseudo random numbers are very important:
//Based on Java's LinearRandom pseudo random number implementation
class Random
{
public:
Random(void);
Random( long seed);
static void setSeed(long _seed);
@wonkwh
wonkwh / ModalDialog.java
Created March 26, 2013 08:51
modal dialog in cocos2d-android
package org.cocos2d.tests;
import android.view.KeyEvent;
import org.cocos2d.actions.base.CCFiniteTimeAction;
import org.cocos2d.actions.ease.CCEaseBackInOut;
import org.cocos2d.actions.instant.CCCallFunc;
import org.cocos2d.actions.instant.CCCallFuncN;
import org.cocos2d.actions.interval.CCMoveTo;
import org.cocos2d.actions.interval.CCSequence;
import org.cocos2d.config.ccMacros;
@wonkwh
wonkwh / unpack_plist.py
Created July 19, 2013 10:22
extract image from plist,png file created by texturepacker
#/usr/local/bin/python
import os,sys
from xml.etree import ElementTree
from PIL import Image
def tree_to_dict(tree):
d = {}
for index, item in enumerate(tree):
if item.tag == 'key':
if tree[index+1].tag == 'string':
@wonkwh
wonkwh / gypify.py
Created December 2, 2013 06:38 — forked from sixman9/gypify.py
#!/usr/bin/python
#gypify.py for GYP (http://code.google.com/p/gyp)
#Found @ http://code.google.com/p/gyp/issues/detail?id=82 (Oct 1, 2009)
#Download original @ http://gyp.googlecode.com/issues/attachment?aid=1601673567448205219&name=gypify.py&token=qm9EhXN3mZxrS1pniUgsh5nG6Bs%3A1328804204976
#Attached is a script that converts a set of existing Chromium-dependent
#.sln and .vcproj files to .gyp. It currently supports executable, shared
#library, static library and build event projects. The output .gyp file is
#created by:
@wonkwh
wonkwh / .gdbinit
Created January 29, 2014 07:25 — forked from skyscribe/.gdbinit
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
#!/bin/bash
f=$(pwd)
mkdir drawable-mdpi drawable-hdpi drawable-xhdpi drawable-xxhdpi
# fake argv and argc in bash
argc=$#; argv[0]=$0 # argv[0] is a prog name
for foo in $( seq $argc )
do
function _common_section
printf $c1
printf $argv[1]
printf $c0
printf ":"
printf $c2
printf $argv[2]
printf $argv[3]
printf $c0
printf ", "