Skip to content

Instantly share code, notes, and snippets.

View linjunpop's full-sized avatar
🐚
Sleeping

Jun Lin linjunpop

🐚
Sleeping
View GitHub Profile
@linjunpop
linjunpop / Gemfile
Created May 10, 2013 00:52
Carrierwave-mongoid with mongoid 4
gem 'carrierwave-mongoid', github: 'jnicklas/carrierwave-mongoid'
gem 'mongoid', github: 'mongoid/mongoid'
@linjunpop
linjunpop / content-type.rb
Created May 8, 2013 02:14
Get file content type from filename.
filename = 'foobar.zer.png'
def content_type
extname = File.extname(filename)[1..-1]
Mime::Type.lookup_by_extension(extname)
end
@linjunpop
linjunpop / github-time-tracking-chrome-extension.js
Last active December 17, 2015 01:49
Github time tracking Chrome extension for AC.
chrome.tabs.query(
{'active': true, 'currentWindow': true},
function (tabs) {
var tab = tabs[0]
var url = tab.url;
var title = tab.title;
var pattern = /https:\/\/github.com\/pracstrat\/(\w+)\/issues\/(\w+)/
var search = tab.url.match(pattern)
jQuery.ajax({
@linjunpop
linjunpop / install-pandoc.md
Last active July 15, 2018 13:30
Install pandoc

Install pandoc on Mac OS X 10.8

Install

Install haskell-platform

$ brew install haskell-platform
@linjunpop
linjunpop / message.rb
Last active June 23, 2016 04:33
Sidekiq + Grocer
class Message
include Mongoid::Document
include Mongoid::Timestamps
field :alert, type: String
field :badge, type: Integer, default: 0
field :sound, type: String
field :schedule, type: DateTime
field :custom, type: Hash
@linjunpop
linjunpop / Integrate-backup-with-rails.md
Last active December 14, 2015 21:18
Integrate Backup with Rails
@linjunpop
linjunpop / README.md
Last active December 14, 2015 15:09
Time tracking with Github
@linjunpop
linjunpop / sync-ruby-version.md
Created March 1, 2013 01:48
Sync ruby version between development and staging/production server

Sync ruby version between development and staging/production server

RVM

in config/deploy.rb

set :rvm_ruby_string, -> { File.read('.ruby-version') }
@linjunpop
linjunpop / github-correct-way.md
Last active October 22, 2021 22:15
Github the correct way.

Use Github, the correct way, IMO

  1. DO NOT commit anything on master, except wording change.
  2. Write descriptive commit messages. (The reason for this change.)
  3. Always use $ git pull --rebase.
  4. DO NOT merge PR raised by yourself.
  5. Close related issue after merge in PR. (Closes #123)
  6. Write down everything in github comments, include links, codes, etc.
  7. Let all tests pass before merge any PR. (CI server FTW)
  8. Add link to related issue in the PR.
@linjunpop
linjunpop / README.md
Last active December 11, 2015 04:18 — forked from agnoster/README.md

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark