Skip to content

Instantly share code, notes, and snippets.

View wastemobile's full-sized avatar

wastemobile wastemobile

View GitHub Profile
@wastemobile
wastemobile / kickstart
Created January 10, 2014 17:11
一個極簡的起手式,使用LESS,具備Vertical Rhythm設計。
/* Vars */
@font-size: 16px;
@vertical-rhythm: @font-size * 1.5;
@fontstack1: sans-serif; /* Headings */
@fontstack2: Georgia, serif; /* Body copy */
@color1: #20bd7c; /* Main theme colour colour */
@color2: #333; /* headings */
@wastemobile
wastemobile / FirstSolution
Last active November 9, 2020 14:23
使用Git與Git Hooks同步專案MySQL資料庫
使用 Git 與 Git Hooks 同步 MySQL 資料庫
=====================================
參考來源: [Synchronizing a MySQL Database with Git and Git Hooks](http://ben.kulbertis.org/2011/10/synchronizing-a-mysql-database-with-git-and-git-hooks/)
目前採用的方法,也是利用 Git Hooks,基本有兩個:
1. push-db:將本地異動推到遠端前運行,讓本地資料庫 => 遠端資料庫(pre-push)。
2. pull-db:將遠端異動拉回本地後運行,讓遠端資料庫 => 本地資料庫(post-update)。
@wastemobile
wastemobile / ghost
Created May 29, 2014 02:45
Ghost Develop and Production setting
// # Ghost Configuration
// Setup your Ghost install for various environments
// Documentation can be found at http://docs.ghost.org/usage/configuration/
var path = require('path'),
config;
config = {
// ### Development **(default)**
development: {
@wastemobile
wastemobile / post-receive
Created June 12, 2014 03:55
嘗試讓包含 submodule 的 git repo 也能自動化部署
#!/bin/sh
#
# 這個範例
# An example hook script to update the working tree, including its
# submodules, after receiving a push.
#
# This hook requires core.worktree to be explicitly set, and
# receive.denyCurrentBranch to be set to false.
#
# To enable this hook, rename this file to "post-receive".
@wastemobile
wastemobile / imagejs
Created June 20, 2014 02:20
摸清楚
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var gCanvas;
var gCtx;
function load(){
console.log("loaded");
gCanvas = document.getElementById("mcanvas");
if (gCanvas.getContext){
@wastemobile
wastemobile / toc
Created June 21, 2014 01:37
Generate FoldingText TOC with Applescript
tell application "FoldingText"
tell front document
evaluate script "function(editor, options) {
var tree = editor.tree(),
headings = tree.evaluateNodePath('//heading'),
toc = [];
headings.forEach(function(each) {
var level = each.typeIndentLevel(),
text = '- ' + each.text();
使用 Asciidoc,測試整合 Hipchat
=== HTMLBook
HTMLBook 是一個開放專案,使用 XHTML5 為基礎,目的是用來撰寫與生產書籍,包含紙本與電子書。它根據下面的前提而開發:
* 書本質上沒有時間性(不包含流通與能見度)。書的基本架構,數百年來均穩定不變,也將持續下去,不管以紙本或數位格式呈現。
* 在可見的未來,HTML 都會是世界通用的標記語言格式。
* 在可見的未來,單一文件來源的生產流程,價值日益提高。
@wastemobile
wastemobile / Install
Last active December 29, 2019 12:38
LNMP, Linux(Mac) + Nginx + MySQL + PHP
安裝 Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X Mavericks using Homebrew
Recently got a new MacBook Pro and decided to set it up from scratch, because I use the same Time Machine backup to migrate from since about four years. Perfect time to get rid of the web server/LAMP (Linux Apache MySQL PHP) stack and replace it with Nginx and PHP-FPM as FastCGI implementation. Below you can read how to setup Nginx, PHP-FPM, MySQL and PhpMyAdmin on OS X 10.9 / Mavericks.
Xcode
First of all, get the latest Xcode version via the Mac App Store:
Download Xcode.app (via Mac App Store)
@wastemobile
wastemobile / asami
Last active August 29, 2015 14:03
Nginx conf.d
server {
listen 80;
server_name asami.local;
root /Users/wastemobile/site/asami;
index index.php index.html index.htm;
charset UTF-8;
location ~ /\.ht {
deny all;
}
@wastemobile
wastemobile / Convert SVG
Last active August 29, 2015 14:04
Convert image to JSON Base64 and POST to a REST API
/**
* Converts an SVG element to an IMG element with the same dimensions
* and same visual content. The IMG src will be a base64-encoded image.
* Works in Webkit and Firefox (not IE).
*/
$.fn.toImage = function() {
$(this).each(function() {
var svg$ = $(this);
var width = svg$.width();
var height = svg$.height();