Skip to content

Instantly share code, notes, and snippets.

View linhmtran168's full-sized avatar
🦖

Linh M. Tran linhmtran168

🦖
View GitHub Profile
@linhmtran168
linhmtran168 / after.sh
Last active March 23, 2016 14:36
Laravel Homestead setup script
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
# Uupdate
sudo apt-get update
# Install some base packages
@linhmtran168
linhmtran168 / Subdirectory Nginx
Created December 15, 2014 06:47
Config Subdirectory for nginx
erver {
listen 80;
server_name oya.dev;
root /home/vagrant/sites/oya/public_html;
index index.html index.htm index.php;
charset utf-8;
location /oya {

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
{{-- Define all our servers --}}
@servers(['staging' => '', 'production' => ''])
@setup
{{-- The timezone your servers run in --}}
$timezone = 'Europe/Amsterdam';
{{-- The base path where your deployments are sitting --}}
$path = '/var/www/site.com/htdocs';
## Server configuration for nginx to host Atlassian Jira / Jetbrain TeamCity or any other Tomcat web application
#
# author cedric.walter, www.waltercedric.com
# to be saved for ex in /etc/nginx/sites-available/example
server {
listen 80;
server_name jira.example.com;
access_log off;
location / {
# to execute this gist, run the line bellow in terminal
\curl -L https://raw.github.com/gist/3875946/install_source_code_pro.sh | sh
@linhmtran168
linhmtran168 / gist:7e573be5eaa137824d6d
Last active August 29, 2015 14:03
Handlebars Helper for If
// If condiational helper
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case '<':
return (v1 < v2) ? options.fn(this) : options.inverse(this);
case '<=':
@linhmtran168
linhmtran168 / handlebarsCell.js
Created June 26, 2014 09:27
Custom Backgrid Cell to render handlebars template
/**
* Custom cell to display handlebars template
*/
HandlebarsCell = Backgrid.Cell.extend({
className: 'handlebars-cell',
render: function () {
this.$el.empty();
this.$el.html(this.column.get('template')({ model: this.model.toJSON() }));
@linhmtran168
linhmtran168 / custom_parse_json.rb
Last active August 29, 2015 14:03
Custom Her Middleware to add additional pagination data to the response metadata
# lib/custome_parse_json
# Custome middleware to include pagination data
class CustomParseJSON < Her::Middleware::ParseJSON
# Parse the response body
#
# @param [String] body The response body
# @param [Hash] header the respone header
# @return [Mixed] the parsed response
# @private
def parse(body, header=nil)
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##