Skip to content

Instantly share code, notes, and snippets.

View linhmtran168's full-sized avatar
🦖

Linh M. Tran linhmtran168

🦖
View GitHub Profile
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):

TODO: make gem for this

This was tested using Rails 3.2 and Rails 4.0 on Ruby 2.0.0.

Bower

  1. Set the install directory for Bower components:

// .bowerrc

@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)
@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 / 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 '<=':
# to execute this gist, run the line bellow in terminal
\curl -L https://raw.github.com/gist/3875946/install_source_code_pro.sh | sh
## 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 / {
{{-- 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';

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"
@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 {