Skip to content

Instantly share code, notes, and snippets.

View wastemobile's full-sized avatar

wastemobile wastemobile

View GitHub Profile

#Meteor and Self-hosted Infrastructure

Meteor is an eye-opening JavaScript framework that runs on both the client and the server, giving developers a revolutionary take on software engineering. If you are not familiar with Meteor, I urge you to visit their website.

##An overview

In this brief gist, I am going to discuss the process of setting up a server (in my case, a VPS) to host Meteor applications.

My experience with Meteor has been brief, however it has not taken much demonstration for me to realise the significance of this stellar framework. Let's jump right in!

@wastemobile
wastemobile / mavericks
Last active August 29, 2015 14:06
Develop Environment Setup
## Node
安裝 nvm 管理 node 與 npm,這個程序若使用 Homebrew 安裝,就算看起來沒問題,但使用一陣子、多半是有更新時,很容易出錯,因此改採自行安裝的方法。
1. git clone https://github.com/creationix/nvm.git ~/.nvm
2. cd ~/.nvm
3. git checkout `git describe --abbrev=0 --tags`
git describe 是尋找距離目前最近的 tag,預設是找正式的標籤,加上參數 `--tags` 則連同輕量級(lightweight - non-annotated tag)也算在內;參數 `--abbrev=<n>` 是修改以七位 hexadecimal 數字的預設,當 `<n>` 等於 `0` 則會捨棄預設的長格式,只將最近的標籤拿來使用。
@wastemobile
wastemobile / flatui
Created September 6, 2014 09:10
Flat UI Colors
// Flat UI Colors
$turquoise : #1ABC9C;
$emerald : #2ECC71;
$peter-river : #3498DB;
$amethyst : #9B59B6;
$wet-asphalt : #34495E;
$green-sea : #16A085;
$nephritis : #27AE60;
$belize-hole : #2980B9;
$wisteria : #8E44AD;
@wastemobile
wastemobile / Laravel
Last active March 10, 2016 09:18
在 Mac 上搭配 MAMP 使用 PHP Composer and Laravel
# 在 Mac 上使用 MAMP, PHP Composer and Laravel
在個人目錄 `~/` 下已建立了 `bin` 目錄,並加入執行路徑中。
前往 `bin` 目錄運行下列指令,會安裝一個 `composer.phar` 檔案。(升級時重複運行這行即可。)
`curl -sS https://getcomposer.org/installer | php`
編輯 `~/.bash_profile` 檔案:
@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();
@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 / 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)
使用 Asciidoc,測試整合 Hipchat
=== HTMLBook
HTMLBook 是一個開放專案,使用 XHTML5 為基礎,目的是用來撰寫與生產書籍,包含紙本與電子書。它根據下面的前提而開發:
* 書本質上沒有時間性(不包含流通與能見度)。書的基本架構,數百年來均穩定不變,也將持續下去,不管以紙本或數位格式呈現。
* 在可見的未來,HTML 都會是世界通用的標記語言格式。
* 在可見的未來,單一文件來源的生產流程,價值日益提高。
@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();
@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){