Skip to content

Instantly share code, notes, and snippets.

Avatar

Jimmy Huang jimyhuang

View GitHub Profile
View allpay_api_sample.php
<?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']
View drupal-lastest-translation.po
msgid "File extensions"
msgstr "副檔名"
msgid "Taxonomy settings"
msgstr "分類設定"
msgid "Cacheable"
msgstr "可快取"
msgid "Processor"
View company-relation-line.php
<?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 Jul 10, 2015
Ansible-playbook bash complete for specific directory
View ansible-playbook.bash
#!/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"
View 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);
View 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 Apr 25, 2015
tile usage sample | Twlandsat - 賽豬公上太空
View twlandsat-sample.html
<!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;
View gist:4b3ea1a73aecd2adf207
LC81170432014333LGN00
LC81170432014333LGN00
LC81170432014365LGN00
LC81170432014365LGN00
LC81170442015032LGN00
LC81170442014013LGN00
LC81170452013330LGN00
LC81170452013330LGN00
LC81170442013330LGN00
LC81170432014253LGN00
View index.html
<!doctype html>
<html>
<head>
<title>Polyline tessellation test with Pixi.js</title>
<meta charset="utf-8">
<style>
html, body {
height: 100%;
padding: 0;