This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
package us.liuyong.widget; | |
import android.view.View; | |
import android.view.ViewGroup.LayoutParams; | |
import android.view.animation.Animation; | |
import android.view.animation.Transformation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Drawable mLoadingDrawable; | |
private Transformation mTransformation; | |
private AlphaAnimation mAnimation; | |
private boolean mHasAnimation; | |
private Interpolator mInterpolator; | |
private long mLastDrawTime; | |
private static final int ANIMATION_RESOLUTION = 200; | |
private static final int MAX_LEVEL = 10000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from PIL import Image | |
def resize(folder, fileName, factor): | |
filePath = os.path.join(folder, fileName) | |
im = Image.open(filePath) | |
w, h = im.size | |
newIm = im.resize((int(w*factor), int(h*factor)), Image.ANTIALIAS) | |
# i am saving a copy, you can overrider orginal, or save to other folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCSprite *pSkill = (CCSprite *) getChildByTag(TAG_MENU)->getChildByTag(tag); | |
CCSprite *pHighLight = CCSprite::createWithSpriteFrameName("point1.png"); | |
this->addChild(pHighLight, Z_ORDER_TITLE, TAG_SKILL_HIGHLIGHT); | |
pHighLight->setPosition(pSkill->getPosition()); | |
CCArray *walkAnimFrames = CCArray::create(); | |
for (int i = 1; i<= 4; i++) | |
{ | |
walkAnimFrames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(CCString::createWithFormat("point%d.png", i)->getCString())); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/local/bin/python | |
import os, sys, math | |
from PIL import Image | |
def config_to_dict(atlas_entry): | |
d = {} | |
list = atlas_entry.split(" ") | |
d["frameName"] = list[0] | |
d["width"] = int(list[1]) | |
d["height"] = int(list[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2014 Chris Banes | |
* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<body> | |
<p>Original Image: </p> | |
<img id="demo_img" src="demo_small.png" alt="Original Image"/> | |
<p>Canvas:</p> | |
<canvas id="myCanvas" style="border:1px solid #000000;">your browser does not support the canvas tag </canvas> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WifiConfiguration wifiConfig = new WifiConfiguration(); | |
wifiConfig.SSID = String.format("\"%s\"", ssid); | |
wifiConfig.preSharedKey = String.format("\"%s\"", key); | |
WifiManager wifiManager = (WifiManager)getSystemService(WIFI_SERVICE); | |
//remember id | |
int netId = wifiManager.addNetwork(wifiConfig); | |
wifiManager.disconnect(); | |
wifiManager.enableNetwork(netId, true); | |
wifiManager.reconnect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Use socat to proxy git through an HTTP CONNECT firewall. | |
# Useful if you are trying to clone git:// from inside a company. | |
# Requires that the proxy allows CONNECT to port 9418. | |
# | |
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run | |
# chmod +x gitproxy | |
# git config --global core.gitproxy gitproxy | |
# | |
# More details at http://tinyurl.com/8xvpny |
OlderNewer