Skip to content

Instantly share code, notes, and snippets.

View geekontheway's full-sized avatar

geekontheway geekontheway

  • Shanghai,China
View GitHub Profile
@geekontheway
geekontheway / 0_reuse_code.js
Created June 13, 2014 16:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// 1. How to check if one array has all elements of another?
var importedEmails = ['john@doe.com', 'janet@doe.com'],
existingEmails = ['john@doe.com', 'janet@doe.com', 'fred@mercury.com'];
if(!_.difference(importedEmails, existingEmails).length) console.log('already imported')
// > already imported
// **********************************************************
// 2. How to find what elements are common to two arrays?
curl -L https://www.atom.io/api/updates/download -A "Atom/0.1 CFNetwork/1.5" > Atom.zip
unzip Atom.zip
mv Atom.app /Applications/
gem 'will_paginate'

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

#!/usr/bin/env /usr/local/rvm/wrappers/ruby-1.9.2-p290@puppet/ruby
## Used by M/Monit to send prowl alerts
require 'rubygems'
require 'optparse'
# everyone's API keys
contact_info = {
"grant"=>{"key"=>"my_api_key"}
require 'mechanize'
@username = 'user@domain.com'
@password = 'hi2u'
@download_path = File.expand_path 'downloads'
@wget_cookie = File.expand_path(File.dirname(__FILE__)) + '/wget-cookies.txt'
unless File.directory? @download_path
puts "@{download_path} doesn't exist!"
exit
/path/to/unicorn/log/unicorn.stderr.log
/path/to/production/log/production.log
{
daily
missingok
rotate 180
compress
dateext
# this is important if using "compress" since we need to call
# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \