Skip to content

Instantly share code, notes, and snippets.

@xangin
xangin / ikea_pm25_dht22.yaml
Last active November 28, 2022 07:45
ESPhome IKEA PM2.5 sensor and DHT22 code
esphome:
name: ikea-pm25
platform: ESP8266
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class PhotonManager : Photon.PunBehaviour
{
public static PhotonManager instance;
@nczz
nczz / woocommerce-checkout-fields-for-TW.php
Last active January 31, 2020 09:34
調整適合在台灣銷售的 WooCommerce 結帳頁表單欄位(含郵遞區號自動選擇)Blog: https://www.mxp.tw/5961/
<?php
//functions.php
function woocommerce_version_check($version = '3.3') {
if (function_exists('is_woocommerce_active') && is_woocommerce_active()) {
global $woocommerce;
if (version_compare($woocommerce->version, $version, ">=")) {
return true;
}
}
return false;
@happymanx
happymanx / Zipcode.json
Created April 7, 2016 16:11
Taiwan Zipcode Address
{"city":[{"dist":[{"name":"仁愛區","c3":"200"},{"name":"信義區","c3":"201"},{"name":"中正區","c3":"202"},{"name":"中山區","c3":"203"},{"name":"安樂區","c3":"204"},{"name":"暖暖區","c3":"205"},{"name":"七堵區","c3":"206"}],"name":"基隆市"},{"dist":[{"name":"中正區","c3":"100"},{"name":"大同區","c3":"103"},{"name":"中山區","c3":"104"},{"name":"松山區","c3":"105"},{"name":"大安區","c3":"106"},{"name":"萬華區","c3":"108"},{"name":"信義區","c3":"110"},{"name":"士林區","c3":"111"},{"name":"北投區","c3":"112"},{"name":"內湖區","c3":"114"},{"name":"南港區","c3":"115"},{"name":"文山區","c3":"116"}],"name":"台北市"},{"dist":[{"name":"萬里區","c3":"207"},{"name":"金山區","c3":"208"},{"name":"板橋區","c3":"220"},{"name":"汐止區","c3":"221"},{"name":"深坑區","c3":"222"},{"name":"石碇區","c3":"223"},{"name":"瑞芳區","c3":"224"},{"name":"平溪區","c3":"226"},{"name":"雙溪區","c3":"227"},{"name":"貢寮區","c3":"228"},{"name":"新店區","c3":"231"},{"name":"坪林區","c3":"232"},{"name":"烏來區","c3":"233"},{"name":"永和區","c3":"234"},{"name":"中和區","c3":"235"},{"name":"土城區","c3":"236"},{"name":"三峽區","c3":"237"},{"name":"樹林區","c3":"23
@064023
064023 / timing4.php
Last active January 10, 2019 10:51
臺中市公車結合去回程的動態到站時刻表
<?php
mb_parse_str($_SERVER["QUERY_STRING"], $qs);
$rid = array_key_exists('rid', $qs) ? $qs["rid"] : "";
$timeformat = array_key_exists('timeformat', $qs) ? $qs["timeformat"] : "0";
$refresh = array_key_exists('refresh', $qs) ? $qs["refresh"] : "0";
$reverse = array_key_exists('reverse', $qs) ? $qs["reverse"] : "0";
$hidecar = array_key_exists('hidecar', $qs) ? $qs["hidecar"] : "0";
$dark = array_key_exists('dark', $qs) ? $qs["dark"] : "0";
$ivrno = array_key_exists('ivrno', $qs) ? $qs["ivrno"] : "";
$stopID = array_key_exists('stopID', $qs) ? $qs["stopID"] : "";
@imhuytq
imhuytq / keygen.html
Created August 5, 2014 06:51
CKFinder 2.x keygen
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CKFinder Keygen</title>
</head>
<body>
<table style="border: 1px solid #999;">
<thead>
<tr>
@Appletone
Appletone / FBTweak
Last active August 29, 2015 14:03
How to use Facebook Tweaks (FBTweak)
// app delegate
#import <FBTweak.h>
#import <FBTweakShakeWindow.h>
#import <FBTweakInline.h>
#import <FBTweakViewController.h>
#ifdef DEBUG
BOOL static const IS_DEBUG = YES;
#else
BOOL static const IS_DEBUG = NO;
@yume190
yume190 / alertController.m
Last active August 29, 2015 14:02
UIAertController Usage
changeAlert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
UIAlertController* __weak weakAlert = changeAlert;
UIAlertAction *alertActionOk = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
UITextField *t = [[weakAlert textFields] firstObject];
DLog(@"%@",t.text);
[weakAlert dismissViewControllerAnimated:YES completion:nil];
}];
UIAlertAction *alertActionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
DLog(@"%@",action);
@ihower
ihower / gist:6132576
Last active June 12, 2019 05:42
Git commit without commit
# First commit
echo "hello" | git hash-object -w --stdin
git update-index --add --cacheinfo 100644 ce013625030ba8dba906f756967f9e9ca394464a hello.txt
git write-tree
git commit-tree aaa96c -m "First commit"
git update-ref refs/heads/master 30b060d9a7b5e93c158642b2b6f64b2b758da40d
# Second commit