Skip to content

Instantly share code, notes, and snippets.

View tuanmai's full-sized avatar
🎯
Focusing

Tuan Mai tuanmai

🎯
Focusing
View GitHub Profile
@tuanmai
tuanmai / gist:5caaae7df3454259ee2aa502f79a2431
Created April 27, 2016 14:51 — forked from afeld/gist:5704079
Using Rails+Bower on Heroku
heroku config:set BUILDPACK_URL='git://github.com/qnyp/heroku-buildpack-ruby-bower.git#run-bower'
#https://github.com/qnyp/heroku-buildpack-ruby-bower/wiki
heroku buildpacks:set https://github.com/qnyp/heroku-buildpack-ruby-bower.git#run-bower
# rbtrace -p PID -e 'Thread.new{require "objspace"; ObjectSpace.trace_object_allocations_start; GC.start(); ObjectSpace.dump_all(output: File.open("heap_#{Time.now.to_i}.json", "w"))}.join'
# Gather three snapshots
# Remove common objects in snapshot 1 from snapshot 2
# Remove missing objects in snapshot 3 from snapshot 2
#!/usr/bin/env ruby
require 'set'
require 'json'
if ARGV.length != 3
mongod --dbpath ~/code/Involvio/mongo --setParameter textSearchEnabled=true
@tuanmai
tuanmai / redis-autostart-osx.md
Created April 8, 2016 08:42 — forked from subfuzion/redis-autostart-osx.md
redis auto start OS X

Install with Homebrew

brew install redis

Set up launchctl to auto start redis

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

/usr/local/opt/redis/ is a symlink to /usr/local/Cellar/redis/x.y.z (e.g., 2.8.7)

@tuanmai
tuanmai / fix-homebrew-npm.md
Created September 29, 2015 17:29 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you may see an error like this:

$ npm update npm -g
@tuanmai
tuanmai / active_admin.js
Last active August 29, 2015 14:27 — forked from agarciadelrio/active_admin.js
Getting active_admin panels become collapsable with non-intrusive javascript with jquery
//....add this in app/assets/javascript/active_admin.js
$(function(){
// CONFIGURE PANELS COLLAPSER
$(".panel[data-panel]").each(function(){
var $this = $(this);
var $a = $("<a href='javascript:void(null)'>").on("click",function(event){
$(this).closest(".panel").find(".panel_contents").each(function(){
$(this).slideToggle();
});
$(this).closest("h3").each(function(){
@tuanmai
tuanmai / active_admin.js
Last active August 29, 2015 14:26 — forked from ascot21/active_admin.js
Inline Editing in ActiveAdmin with Best In Place Gem
//= require jquery
//= require best_in_place
//= require jquery.purr
//= require active_admin/base
$(document).ready(function() {
$(".best_in_place").best_in_place()
$('.best_in_place').bind("ajax:success", function () {$(this).closest('tr').effect('highlight'); });
$(document).on('best_in_place:error', function(event, request, error) {

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname