Skip to content

Instantly share code, notes, and snippets.

View ptgamr's full-sized avatar

Anh Trinh ptgamr

View GitHub Profile
[
{
"tracks": [],
"name": "Starred",
"id": 1428756650503
},
{
"tracks": [
{
"id": "nA43UrtWHqw",
@ptgamr
ptgamr / couch-db-install.md
Created April 13, 2015 22:44
CouchDB installation Ubuntu
# install the ppa-finding tool
# for 12.04 release
sudo apt-get install python-software-properties -y
# for 14.04 release
sudo apt-get install software-properties-common -y
# add the ppa
sudo add-apt-repository ppa:couchdb/stable -y
# update cached list of packages
sudo apt-get update -y
@ptgamr
ptgamr / soundcloudify-sync.md
Created April 14, 2015 05:03
SoundCloudify sync approach

ON APP INIT

  • User has not login to Chrome: no server communication needed. only store data to local storage.

  • When user login to Chrome (profile_id is defined)

ON APP INIT

  • check if user is in the database
@ptgamr
ptgamr / notes.md
Created April 21, 2015 14:25
notes

NowPlaying:

  • no need for POST call
  • When add track, if nowplaying list does not existed yet, created it
  • the call PUT /nowplaying can accept a list of tracks
@ptgamr
ptgamr / sync.spec.md
Last active August 29, 2015 14:21
synchronization spec

GIVEN: client1 & client2

Add Track

WHEN client2 [addtrack] AND client1 [addtrack] THEN

GIVEN client1 = [1,2,3,4,5] (sync)
THEN client2 add track: server = [1,2,3,4,5,6]
THEN client1 add track: client1 = [1,2,3,4,5,6]

THEN client1 pull: client1 = [1,2,4,5,6 (from client1), 6 (from client2)]

tmux shortcuts & cheatsheet

~/.tmux.conf

# remap prefix to Control + a
set -g prefix C-a
# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b
@ptgamr
ptgamr / bug-report-guideline.md
Last active August 29, 2015 14:21
Reporting bug guideline - SoundCloudify

When the extension is not working for you or there are some strange issue that happened. Please follow these steps in order to give me the most detail error code... So that I can work on a fix.

    1. Open chrome://extensions page
    1. Enable developer mode (located at the top right)
    1. Locate the extension, and click [Inspect views: background.html]
    1. Now the Developer Tool is open. Go to the console tab and paste me the error

Thanks you a lot for your time!

cd /var/log/nginx
zcat -f access.log* | goaccess -a
#! /usr/bin/node
var MongoClient = require('mongodb').MongoClient
var Server = require('mongodb').Server;
var async = require('async');
var util = require('util');
// A simple linear congruence random number generator.
// This is anticipating doing a comparable test with the aggregation pipeline.
var randMod = 2 << 24;
@ptgamr
ptgamr / fixup-istvan.js
Created June 5, 2015 05:26
fixup-istvan
(function(){
'use strict';
function mdDataTableDirective($compile){
return {
restrict: 'E',
templateUrl: '/main/templates/mdDataTable.html',
transclude: true,
scope: {
tableCard: '=',