Skip to content

Instantly share code, notes, and snippets.

View JimRoid's full-sized avatar

黃文錦 JimRoid

View GitHub Profile
@JimRoid
JimRoid / CityList.php
Created March 6, 2025 16:26
controller
class CityList extends Action
{
public function initView(Request $request, Response $response, $args = []): ResponseInterface
{
$cityId = 0;
if (isset($args['cityId'])) {
$cityId = $args['cityId'];
}
$body = $request->getParsedBody();
@JimRoid
JimRoid / AllGattCharacteristics.java
Created September 19, 2022 11:47 — forked from sam016/AllGattCharacteristics.java
Bluetooth GATT Services & Characteristics
package com.sam016.vsflatomation.service.ble;
import java.util.HashMap;
import java.util.UUID;
public class AllGattCharacteristics {
private static HashMap<String, String> attributes = new HashMap();
static {
attributes.put("00002a00-0000-1000-8000-00805f9b34fb", "Device Name");
@JimRoid
JimRoid / docker-compose.yml
Created July 20, 2021 07:32
docker mysql5.7 phpmyadmin 4.9.6
version: '1'
services:
mysql:
image: mysql:5.7
container_name: mysql5.7
restart: always
environment:
MYSQL_DATABASE: jim
MYSQL_USER: jim
private void print1DCode39(Printer printer, String content) {
byte[] bytes = content.getBytes();
byte[] cmd = new byte[bytes.length + 4];
//code 39條碼指令
cmd[0] = 0x1D;
cmd[1] = 0x6B;
cmd[2] = 69;
cmd[3] = (byte) bytes.length;
for (int i = 0; i < bytes.length; i++) {
cmd[4 + i] = bytes[i];
@JimRoid
JimRoid / sendPosCommand
Created August 25, 2017 02:58
傳送pos機藍芽指令
//"1D4800"
command = PrinterCommand.BarCodePositionHRI;
printer.addCommand(getHexBytes(command));
//"1D6840"
command = PrinterCommand.BarCodeSetHeight;
printer.addCommand(getHexBytes(command));
//"1D7702"
command = PrinterCommand.BarCodeSetWidth;
@JimRoid
JimRoid / LatLngTools.java
Created August 14, 2017 08:47
取回兩點間的距離
/**
* 取回兩點間的距離
*
* @param start
* @param end
* @return
*/
public static double getDistance(LatLng start, LatLng end) {
double lat1 = (Math.PI / 180) * start.latitude;
double lat2 = (Math.PI / 180) * end.latitude;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.IOException;
import java.io.StringReader;
/**
* Created by jim on 2016/2/24.
*/
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
public abstract class SceneAnimation {