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
// 示例: 'testtesttest'.subX(4, true) | |
// 返回: 'test...' | |
// 第二个参数可选,为true时,为截断的字符串添加英文省略号 | |
String.method ('subX', function (len, hasDot) { | |
"use strict"; | |
var newLength = 0; | |
var newStr = ""; | |
var chineseRegex = /[^\x00-\xff]/g; | |
var singleChar = ""; | |
var strLength = this.replace(chineseRegex,"**").length; |
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
function sumAll() { | |
var i, sum = 0 | |
for (i=0; i<arguments.length; i++) { | |
sum += arguments[i] | |
} | |
return sum | |
} | |
sumAll(1, 2, 3) |
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
M.app = { | |
editAddress: function() { | |
var elForm = document.getElementById('address-form'); | |
elForm.onclick = function(e) { | |
if (elForm.address.value === '') return false; | |
}; | |
elForm.address.focus(); | |
} | |
}; |
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
# Ubuntu | |
# OSX |
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/bash | |
# Sample usage is as follows; | |
# ./signapk myapp.apk debug.keystore android androiddebugkey | |
# | |
# param1, APK file: Calculator_debug.apk | |
# param2, keystore location: ~/.android/debug.keystore | |
# param3, key storepass: android | |
# param4, key alias: androiddebugkey | |
USER_HOME=$(eval echo ~${SUDO_USER}) |
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
function get-url-item { | |
echo $1 | awk -F/ '{ print $'$2' }' | |
} | |
cut=0 | |
url=$1 | |
# count what our --cut-dir should be, this is nasty to the max | |
while [[ -n `get-url-item $url $[ $cut + 4 ]` ]]; do | |
cut=$[ $cut + 1 ] |
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/bash | |
################################### | |
# Usage: sudo ./installer.sh [os] # | |
################################### | |
OS=$1; | |
UBUNTU=""; | |
############# |
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
@charset "utf-8"; | |
/* ----- twicli.css ----- */ | |
/* | |
twicli用CSS Elsewhither(http://else.jimdo.com/others/storage/)をベースに、 | |
Old Twitterになんとなく似せる感じ | |
*/ | |
@import url('//cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css'); | |
* { |
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
@charset "UTF-8"; | |
/* アイコンフォント読み込み */ | |
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'); | |
/** | |
* 全体 | |
*/ | |
* { | |
outline: none; |