Skip to content

Instantly share code, notes, and snippets.

View donma's full-sized avatar
:octocat:
I wanna play a game.

Donma Hsu donma

:octocat:
I wanna play a game.
View GitHub Profile
@donma
donma / yahoo-weather-condition-codes.json
Last active August 29, 2015 14:19 — forked from bzerangue/yahoo-weather-condition-codes.xml
Roughly translate to Chinese
{
"yahoo-weather-codes": {
"code": [
{
"number": "0",
"description": "龍捲風"
},
{
"number": "1",
"description": "熱帶風暴"
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
#include <M5Stack.h>
#define SERVICE_UUID "0000fff0-0000-1000-8000-00805f9b34fb"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
String Message = "DMESSAGE";
BLEService *pService;
BLEAdvertising *pAdvertising;
BLECharacteristic *pCharacteristic;
@donma
donma / BLEClient.ino
Created May 8, 2018 09:07
BLEClient.ino
/**
* A BLE client example that is rich in capabilities.
*/
#include "BLEDevice.h"
#include <M5Stack.h>
//#include "BLEScan.h"
// The remote service we wish to connect to.
static BLEUUID serviceUUID("0000fff0-0000-1000-8000-00805f9b34fb");
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
namespace TestLineNotify
{
public partial class index : System.Web.UI.Page
{
WebClient wc4 = new WebClient();
string targetAddress4 = "https://rest.nexmo.com/sms/json";
wc4.Encoding = Encoding.UTF8;
wc4.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
NameValueCollection nc4 = new NameValueCollection();
nc4["api_key"] = YOUR_API_KEY;
nc4["api_secret"] = YOUR_API_SECRET;
nc4["to"] = mobile;
//必填
nc4["from"] = "no2studio";
@donma
donma / uploadimage.ashx.cs
Last active July 2, 2018 09:06
Editor.Md - upload image using asp.net
using System;
using System.IO;
using System.Web;
using System.Web.Script.Serialization;
namespace MDEditorUploadImage
{
public class uploadimage : IHttpHandler
{
@donma
donma / upload-image-aspx.html
Created July 2, 2018 09:10
Editor.md - upload-image-aspx.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>图片上传示例 - Editor.md examples</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
@donma
donma / chart-pie-tooltip-part-code.js
Last active July 3, 2018 09:15
Chart.js Pie Tooltips
// 關於滑過後的 顯示
tooltips: {
callbacks: {
label: function (tooltipItem, data) {
var dataset = data.datasets[tooltipItem.datasetIndex];
//計算總和
var sum = dataset.data.reduce(function (previousValue, currentValue, currentIndex, array) {
return previousValue + currentValue;
});
var currentValue = dataset.data[tooltipItem.index];
//提示項目的處理
legend: {
display: true,
position: 'left',
labels: {
generateLabels: function (chart) {
var data = chart.data;
if (data.labels.length && data.datasets.length) {
return data.labels.map(function (label, i) {
var ds = data.datasets[0];
@donma
donma / StarSignsUtil.cs
Created July 10, 2018 07:12
C# Get Star Sign Fate Today Utility From Sina
using System.Linq;
public static class StarSignsUtil
{
/// <summary>
/// 紀錄星座資料的模型
/// </summary>
public class StarSignInfo