Skip to content

Instantly share code, notes, and snippets.

View augustine-tran's full-sized avatar

Khanh Tran augustine-tran

  • Ho Chi Minh, Vietnam
  • 21:17 (UTC +07:00)
View GitHub Profile
DELETE
DELETE _template/{name}
DELETE {index}
DELETE {index}/_alias/{name}
DELETE {index}/_query
DELETE {index}/_warmer
DELETE {index}/_warmer/{name}
DELETE {index}/{type}
DELETE {index}/{type}/_mapping
DELETE {index}/{type}/_query
@augustine-tran
augustine-tran / javascript_resources.md
Created October 26, 2013 03:05 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
- (IBAction)buyMoreButtonClicked:(id)sender
{
[GGProgressHUD showActivity];
NSString *productId = nil;
if (sender == btnCredit1) {
productId = IAP_PRODUCT_CREDIT1;
} else if (sender == btnCredit2) {
productId = IAP_PRODUCT_CREDIT2;
} else {
productId = IAP_PRODUCT_CREDIT3;
- (IBAction)buyMoreButtonClicked:(id)sender
{
[GGProgressHUD showActivity];
NSString *productId = IAP_PRODUCT_CREDIT;
SKProduct *product = [[TNStoreHelper requestedProducts] valueForKey:productId];
if (product) {
[self purchaseProduct:product];
return;
}
@augustine-tran
augustine-tran / S3-CORS-config.xml
Created December 23, 2015 14:05 — forked from zxbodya/S3-CORS-config.xml
Client side uploads to s3, with pre-signed upload form (PHP/JS)
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#
@augustine-tran
augustine-tran / pagination.js
Created February 15, 2017 16:35
Adding pagination to knex.js
var Knex = require('knex');
var Promise = require('bluebird');
Object.assign(Knex.Client.prototype.QueryBuilder.prototype, {
paginate(per_page, current_page) {
var pagination = {};
var per_page = +per_page || 8;
var page = +current_page || 1;
if ( page < 1 ) page = 1;
var offset = (page - 1) * per_page;
@augustine-tran
augustine-tran / gist:c7098b1a2e14d3260503a0ed027b6ecb
Created March 6, 2017 04:11 — forked from seanmcn/gist:62a021a765ad4f8e593b
The Perfect Web Server - Nginx, Ajenti, Ubuntu
#Insall Ajenti
apt-get update
wget http://repo.ajenti.org/debian/key -O- | apt-key add -
echo "deb http://repo.ajenti.org/ng/debian main main ubuntu" >> /etc/apt/sources.list
apt-get update
apt-get install ajenti
service ajenti restart
# Uninstall Apache2
sudo apt-get autoremove && sudo apt-get remove apache2*
@augustine-tran
augustine-tran / docker-cleanup-resources.md
Created April 4, 2017 09:19 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm