Skip to content

Instantly share code, notes, and snippets.

Edward Chiang edwardinubuntu

Block or report user

Report or block edwardinubuntu

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
@edwardinubuntu
edwardinubuntu / log.txt
Created Jun 28, 2017
TSC printer print command log
View log.txt
Command: 
 TEXT 290,50,”TST24.BF2",0,1,1,3,”0001(1/1)”
 TEXT 25,78,”TST24.BF2",0,1,1,”檸檬汁(中)”
 TEXT 25,106,”TST24.BF2",0,1,1,””
 TEXT 25,134,”TST24.BF2",0,1,1,”售價$45 (外帶)”
 TEXT 25,162,”TST24.BF2",0,1,1,”一小時內飲用最佳”
 TEXT 25,190,”TST24.BF2",0,1,1,”日傑茶坊 TEL:0000–0000"
@edwardinubuntu
edwardinubuntu / OrderParseWriter.java
Last active Jun 27, 2017
How to convert source object to target object.
View OrderParseWriter.java
private Order convert(ShoppingOrder shoppingOrder) {
ModelMapper modelMapper = new ModelMapper();
Order order = modelMapper.map(shoppingOrder, Order.class);
return order;
}
@edwardinubuntu
edwardinubuntu / TripMembersSection.java
Last active Jun 27, 2017
Use DownloadImageTask in UI.
View TripMembersSection.java
userImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
DownloadImageTask downloadImageTask = new DownloadImageTask();
downloadImageTask.setOnBitmapDownloadListener(new DownloadImageTask.OnBitmapDownloadListener() {
@Override
public void result(Bitmap bitmap) {
if (bitmap != null) {
userImageView.setImageBitmap(BitmapLoader.resizeImageForImageView(bitmap,
Math.max(userImageView.getMeasuredWidth(), userImageView.getMeasuredHeight())));
}
}
@edwardinubuntu
edwardinubuntu / DownloadImageTask.java
Created Jun 27, 2017
Download image with OKHttpClient in AsyncTask.
View DownloadImageTask.java
package io.triptime.android.service;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import java.io.IOException;
import io.triptime.android.TripTime;
@edwardinubuntu
edwardinubuntu / build.gradle
Created Jun 14, 2017
Correct version for device to connect with printer.
View build.gradle
apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
View SettinsFragment.java
try {
String appVersion = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName;
SharedPreferences.Editor editor = preferences.edit();
editor.putString(PREFERENCES_KEY_APP_VERSION, appVersion);
editor.apply();
} catch (PackageManager.NameNotFoundException e) {
Log.e(Carce.TAG, e.getLocalizedMessage());
}
@edwardinubuntu
edwardinubuntu / MemberActivity.java
Created Mar 13, 2017
Create signature from package manager.
View MemberActivity.java
try {
String appVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
contentAdapter.addItem(new ItemObject("版本 " + appVersion, null));
Signature[] sigs = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES).signatures;
StringBuffer signBffer = new StringBuffer();
for (Signature sign: sigs) {
signBffer.append(sign.toCharsString());
@edwardinubuntu
edwardinubuntu / OrderStepsFragment.java
Created Jan 18, 2017
四捨五入小數點捨去法 Rounding unconditional rounding
View OrderStepsFragment.java
public static double round(double d, int decimalPlace) {
BigDecimal bd = new BigDecimal(d);
bd = bd.setScale(decimalPlace, BigDecimal.ROUND_FLOOR);
return bd.doubleValue();
}
@edwardinubuntu
edwardinubuntu / README.md
Last active Nov 29, 2016
tibame.com iOS Swift 網路服務應用 - 資料接收
View README.md

資料傳輸

實作一個程式,可以透過給定 url,下載資料內容,下載圖片。

@edwardinubuntu
edwardinubuntu / README.md
Last active Nov 28, 2016
tibame.com iOS Swift 綜合練習題
View README.md

台北市銀髮族服務 - 社區照顧關懷據點

實作一個臺北市銀髮族服務據點查詢 App。

涵蓋課程範圍

  • 網路
  • 地圖
  • Storyboard 介面指示 Actionsheet
  • Storyboard 基本介面
You can’t perform that action at this time.