Skip to content

Instantly share code, notes, and snippets.

View patw0929's full-sized avatar

Patrick Wang patw0929

View GitHub Profile
@leommoore
leommoore / letsencrypt_ubuntu_nginx.md
Last active August 8, 2018 10:37
Letsencrypt Ubuntu 14.04 Nginx

#Letsencrypt Ubuntu 14.04 Nginx Letsencrypt (https://letsencrypt.org) is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain.

Note: As of 8th March 2016 letsencrypt is still in public beta.

##Installation To install the client, clone the repostiory from github.

git clone https://github.com/letsencrypt/letsencrypt.git
@vrusua
vrusua / #dev_xhr-iframe.md
Last active November 25, 2025 14:25
Cross domain messaging and dynamic iframe height
@fokayx
fokayx / DeployToDigitalOcean.md
Last active August 29, 2015 14:19
Deploy a Rails App with Passenger and Nginx on Ubuntu 14.04 @ DigitalOcean

佈署Rails APP到DigitalOcean

Pessenger/ Nginx / Ubuntu 14.04

###步驟1: 建立DigitOcean帳戶、選擇方案,Ubuntu系統
選擇DigitalOcean方案: 一開始測水溫的APP雞絲就用$5/月的唄,DigitalOcean常常發出一些新用戶優惠的例如:免費送你$10。

選擇Ubuntu系統: 32bit Ubuntu,64bit比32多用約50%的記憶體,如果你需要台大機器,或者可能記憶體可能升級到超過4GB以上,那麼就直上64-bit

@max-mykhailenko
max-mykhailenko / # Sublime Emmet JSX Reactjs.md
Last active November 25, 2022 23:25
Sublime text 3. Enable Emmet in JSX files with Sublime React plugin

This is no longer needed as Emmet supports JSX - you just need to turn it all on. Did a quick tutorial: http://wesbos.com/emmet-react-jsx-sublime/

Thanks, @wesbos

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed
@app.route('/login/<provider_name>', methods=['GET', 'POST'])
@authomatic.login('g')
@requires_ssl
def login(provider_name):
if g.user is not None and g.user.is_authenticated():
return redirect(url_for('index'))
if authomatic.result:
if authomatic.result.error:
return 'Something went wrong: {0}'.format(authomatic.result.error.message)
if authomatic.result.user:
@jcouyang
jcouyang / 3-reason-to-use-jest-to-test-your-javascript.md
Last active March 24, 2019 13:58
用 jest 轻松测试 JavaScript

Javascript 的测试, 不管在用 jasmine 还是 mocha, 都是很头疼的事情. 但是自从有了 jest, 一口气写7个测试, 腰也不疼了, 头也不疼了.

只需要 3 个理由

在说用 jest 测为什么好之前,我们先来看我们要测的一个例子.

@asika32764
asika32764 / URI.js
Last active August 29, 2015 14:04
The simple JS URI object. Repository move to https://github.com/asika32764/SimpleURI.js
/*!
* The simple JS URI object.
*
* @license GNU General Public License version 2 or later; see LICENSE
* @link https://gist.github.com/asika32764/6556efdf5c593ce140bb
*/
/**
* The simple JS URI object.
*
@LiamChapman
LiamChapman / xhr.js
Last active February 7, 2018 13:24
Quick and Simple XMLHttpRequest
window.xhr = function (url, callback, method, params) {
if (typeof callback !== 'function' ) throw "no callback passed!";
try {
var xmlhttp = new XMLHttpRequest() || new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
callback(xmlhttp.responseText);
}
};
xmlhttp.open(method||"GET", url, true);
@patw0929
patw0929 / gist:9167f911223b0c30bd76
Last active April 15, 2023 15:47
Mac OSX 開發環境安裝

Mac OSX 開發環境安裝

推薦安裝的應用程式

  • iTerm2 - 比內建的終端機漂亮且強大
  • VSCode
  • BetterTouchTool - 拖拉視窗最大化、增加特定程式的滑鼠手勢
  • Magnet - 快速切換視窗位置(免費替代:VEEER
  • MacDown - 寫 Markdown 筆記方便,可以先寫好再貼到 GitHub、gist 作筆記。
@codler
codler / flex.less
Last active October 7, 2023 07:01
Prefix flex for IE10 and Safari / iOS in LESS
/*! Prefix flex for IE10 and Safari / iOS in LESS
* https://gist.github.com/codler/2148ba4ff096a19f08ea
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
.display(@value) when (@value = flex) {
display: -ms-flexbox; // IE10
display: -webkit-flex; // Safari / iOS
}
.display(@value) when (@value = inline-flex) {