Skip to content

Instantly share code, notes, and snippets.

View snippets-tm.go
/**
*
* Snippets.me TextMate Distributor replacement script
*
* TextMate Distributor is not working after TextMate 2 bundle identifier changed,
* the script remove all exists snippets from TextMate, then add valid snippets.
*
* @author Ethan Liu - https://creativecrap.com
*
* References:
@ethanliu
ethanliu / iTunes.swift
Created Jul 13, 2016 — forked from pvieito/iTunes.swift
iTunes ScriptingBridge header
View iTunes.swift
//
// iTunes.swift
//
import AppKit
import ScriptingBridge
// MARK: Enum Definitions -
@objc enum iTunesEKnd: NSInteger {
@ethanliu
ethanliu / xcode-todo.sh
Created Jun 1, 2016
Xcode Build Script - Mark TODO, FIXME as waring
View xcode-todo.sh
KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | \
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | \
perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@ethanliu
ethanliu / xcode-bundle-version.sh
Created Jun 1, 2016
Xcode Build Script - Use git HEAD counts for CFBundleVersion without dirty the repo
View xcode-bundle-version.sh
git=`sh /etc/profile; which git`
appBuild=`"$git" rev-list HEAD --count`
infoPath="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
#infoPath="${PROJECT_DIR}"/"${INFOPLIST_FILE}"
if [ $CONFIGURATION = "Debug" ]; then
branchName=`"$git" rev-parse --abbrev-ref HEAD`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild-$branchName" "$infoPath"
else
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "$infoPath"
@ethanliu
ethanliu / PChome Loader
Created Jan 21, 2015
PChome auto pager script for greasemonkey
View PChome Loader
// ==UserScript==
// @name PChome Loader
// @namespace ETHAN_PCHOME
// @include http://*.pchome.com.tw/*
// @version 1.0.0
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js
// @run-at document-end
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
@ethanliu
ethanliu / disqus2wpxml.php
Created Sep 20, 2013
Convert xml exported from disqus to wordpress format for importing back to disuqs
View disqus2wpxml.php
<?php
/**
* Convert xml exported from disqus to wordpress format for importing back to disuqs
*
* @author Ethan Liu <ethan@creativecrap.com>
* @copyright Creativecrap.com, 20 September, 2013
**/
$feed = new SimpleXMLElement(file_get_contents("src.xml"));