Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Erichain Erichain

🎯
Focusing
Block or report user

Report or block Erichain

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Erichain
Erichain / clientController.js
Last active Mar 3, 2017
Use ionic and express.js to upload files
View clientController.js
app.controller(['$cordovaFileTransfer', function ( $cordovaFileTransfer ) {
// 一定要将代码放在事件监听中
// 表示设备准备好了之后才能执行里面的代码
document.addEventListener('deviceready', function () {
var uploadOptions = new FileUploadOptions(),
server = 'your_server_api',
imgPath = 'your_img_path';
// 注意此处设置的fileKey,Express服务端中也需要这个
uploadOptions.fileKey = 'file';
@Erichain
Erichain / calcDaysDiff.js
Created Mar 11, 2016
A function to calculate the difference between days
View calcDaysDiff.js
function calcDaysDiff( start, end ) {
var currentDate = start || new Date(),
timeDiff = end - currentDate,
timeUnit = 24 * 60 * 60 * 1000,
diff = 0;
diff = (timeDiff - currentDate % timeUnit) / timeUnit + 1;
return Math.floor(diff);
}
@Erichain
Erichain / msconvert.js
Last active Jan 8, 2020 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
View msconvert.js
function convertMS( milliseconds ) {
var day, hour, minute, seconds;
seconds = Math.floor(milliseconds / 1000);
minute = Math.floor(seconds / 60);
seconds = seconds % 60;
hour = Math.floor(minute / 60);
minute = minute % 60;
day = Math.floor(hour / 24);
hour = hour % 24;
return {
@Erichain
Erichain / installAndroidSDKOnMac.md
Last active Dec 21, 2019
Mac OS下安装和配置android-sdk
View installAndroidSDKOnMac.md

##MAC OS下安装和配置android-sdk

###安装

在MAC上安装android-sdk,标准的安装方法是使用homebrew,运行如下命令:

brew update

brew install android-sdk

You can’t perform that action at this time.