Skip to content

Instantly share code, notes, and snippets.

View jimyhuang's full-sized avatar

Jimmy Huang jimyhuang

View GitHub Profile
<?php
civicrm_initialize();
$pid = 1; // payment processor id from system
$payment_processor = CRM_Core_BAO_PaymentProcessor::getPayment($pid, 'live');
$contribution_trxn_id = 'ABCDE12345';
if($payment_processor['payment_processor_type'] == 'ALLPAY' || $payment_processor['payment_processor_type'] == 'ALLPAYX'){
if(!empty($payment_processor['url_recur']) && !empty($payment_processor['user_name'])){
$processor = array(
'password' => $payment_processor['password']
msgid "File extensions"
msgstr "副檔名"
msgid "Taxonomy settings"
msgstr "分類設定"
msgid "Cacheable"
msgstr "可快取"
msgid "Processor"
@jimyhuang
jimyhuang / company-relation-line.php
Last active August 31, 2015 02:32
company-relation
<?php
$BASE = "/mnt/tmp";
$line = file_get_contents("$BASE/tmpline");
preg_match("/^\d+,/", $line, $matches);
$id_dest = trim($matches[0], ',');
$line = str_replace($matches[0], '', $line);
$meta = json_decode($line, TRUE);
@jimyhuang
jimyhuang / ansible-playbook.bash
Created July 10, 2015 14:20
Ansible-playbook bash complete for specific directory
#!/bin/env bash
_ansible_playbook() {
local current_word=${COMP_WORDS[COMP_CWORD]}
local previous_word=${COMP_WORDS[COMP_CWORD - 1]}
if [[ "$current_word" == -* ]]; then
_ansible_complete_options "$current_word"
elif [[ "$current_word" == @* ]]; then
_ansible_target "$current_word"
@jimyhuang
jimyhuang / pet-hsz.php
Created May 31, 2015 10:01
pet-hsz.php
<?php
$page = 0;
$output = '';
`echo '' > /tmp/animal`;
while(1) {
$url = 'http://animalprotection.hchg.gov.tw/sca/C/Animal.aspx?page='.$page;
$doc = new DOMDocument();
$new = new DOMDocument();
$html = @file_get_contents($url);
@jimyhuang
jimyhuang / pet-tpe.php
Created May 30, 2015 07:13
pet-tpe.php
<?php
`curl -s "http://data.taipei/opendata/datalist/apiAccess?scope=resourceAquire&rid=f4a75ba9-7721-4363-884d-c3820b0b917c&format=csv" -o pet-tpe.csv`;
$data = file_get_contents('pet-tpe.csv');
$data = iconv('BIG5', 'UTF-8', $data);
file_put_contents('pet-tpe.csv', $data);
@jimyhuang
jimyhuang / twlandsat-sample.html
Created April 25, 2015 17:26
tile usage sample | Twlandsat - 賽豬公上太空
<!doctype html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<title>tile usage sample | Twlandsat - 賽豬公上太空 </title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
#map {
height: 540px;
LC81170432014333LGN00
LC81170432014333LGN00
LC81170432014365LGN00
LC81170432014365LGN00
LC81170442015032LGN00
LC81170442014013LGN00
LC81170452013330LGN00
LC81170452013330LGN00
LC81170442013330LGN00
LC81170432014253LGN00
@jimyhuang
jimyhuang / index.html
Created April 15, 2015 17:19
Stalmen test
<!doctype html>
<html>
<head>
<title>Polyline tessellation test with Pixi.js</title>
<meta charset="utf-8">
<style>
html, body {
height: 100%;
padding: 0;