Skip to content

Instantly share code, notes, and snippets.

View zeuxisoo's full-sized avatar
🛥️
No response

Zeuxis zeuxisoo

🛥️
No response
View GitHub Profile
@zeuxisoo
zeuxisoo / gist:998348
Created May 30, 2011 01:48
Titanium - Change the app name to support chinese/other word on android

Step 1

  1. open current titanium project (e.g. TestTabIcon/build/android/AndroidManifest.xml)

  2. update the app name

    android:label="TestTabIcon" to android:label="什麼都好"

  3. press cmd + i on AndroidManifest.xml

@zeuxisoo
zeuxisoo / gist:998404
Created May 30, 2011 03:13
git-ftp.sh install and usage note
@zeuxisoo
zeuxisoo / gist:1008973
Created June 5, 2011 13:44
[Android] Create and Remove Desktop Shortcut

Create

private void addShortcut(){  
	Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
          
	// Shortcut name
	shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));  
	shortcut.putExtra("duplicate", false);	// Just create once
@zeuxisoo
zeuxisoo / gist:1008975
Created June 5, 2011 13:48
[Android] Disable Home Button

In Activity (Android 2.0 UP)

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	if (keyCode == KeyEvent.KEYCODE_HOME) {
		Log.i("TAG", "Press Home");
		System.exit(0);
		return true;
	} else {

return super.onKeyDown(keyCode, event);

@zeuxisoo
zeuxisoo / gist:1011581
Created June 7, 2011 02:29
Git checkout remote branch
git clone https://github.com/<User>/<Repo>.git
git branch -r
git checkout -b develop origin/develop
@zeuxisoo
zeuxisoo / app.js
Created June 9, 2011 04:15
Titanium mobile parse html
Ti.include('lib/htmlparser.js');
Ti.include('lib/soupselect.js');
var select = soupselect.select;
var body = '<html><head><title>Test</title></head>'
+ '<body>'
+ '<img src="http://l.yimg.com/mq/i/home/HKGallery.gif" />'
+ '<div id="block">'
+ ' <div class="row">Row 1</div>'
@zeuxisoo
zeuxisoo / spaceText.js
Created June 14, 2011 02:30
Add space between words
function space_text(my_text){
var len = my_text.length;
var text = my_text;
var text2 = text.charAt(0);
for(var i = 1; i < len-1; i++) {
text2 += text.charAt(i);
if(text.charCodeAt(i) > 128 && text.charAt(i+1) != " " && text.charAt(i+1) != "\n")
text2 += " ";
}
@zeuxisoo
zeuxisoo / gist:1037198
Created June 21, 2011 03:44
Dump sql file into each projects
#!/bin/sh
# Author: Neo.Lo
# Create: 2011-06-21 11:38PM
MYSQL_USER=root
MYSQL_PASS=root
MYSQL_DUMP_SCRIPT=/Applications/MAMP/Library/bin/mysqldump
PROJECT_FOLDER=/Applications/MAMP/htdocs/projects/
@zeuxisoo
zeuxisoo / gist:1048337
Created June 27, 2011 05:08
Detect current window zoom in or zoom out
<script lanugage="javascript" type="text/javascript">
(function(window, undefined) {
var currentWidth = window.screen.width;
window.onresize = function() {
if (window.screen.width < currentWidth) {
console.log("Zoom In");
}else{
console.log("Zoom Out");
@zeuxisoo
zeuxisoo / gist:1048403
Last active September 26, 2015 05:37
javascript random cards on Big2 / DuDiZhu
<script lanugage="javascript" type="text/javascript">
/*
* Author: Zeuxis.Lo
* Description: random cards on Big2 / DuDiZhu
*/
(function(window, undefined) {
var DealCard = function() {
this.roleA = [];
this.roleB = [];