Skip to content

Instantly share code, notes, and snippets.

@jcreixell
jcreixell / solvedarts.py
Created May 15, 2012 07:41
Darts Game Solution
import itertools
for i in range(1,10):
for j in itertools.combinations_with_replacement([16,18,23,24,39,40], i):
if sum(j) == 100:
print j
@jcreixell
jcreixell / gdoc.py
Created May 15, 2012 09:39
Google Doc pandas integration
import gspread
from pandas import *
import logging
class GDocError(Exception):
def __init__(self, value):
self.parameter = value
def __str__(self):
require 'rubygems'
require 'rubygems/package'
require 'zlib'
require 'fileutils'
module Util
module Tar
# Creates a tar file in memory recursively
# from the given path.
#
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
class ApplicationController < ActionController::Base
include ApplicationHelper
protect_from_forgery
before_filter :set_locale
before_filter :require_user
authorize_resource
helper :all
attachments: parent_id, asset_id
domain_names: organisation_id
event_memberships: user_id, event_id
events: editor_id
group_actions: user_id, group_id
groups: user_id
icons: parent_id
invitations: sender_id
legacy_actions: item_upon_id
news_items: author_id

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
// PUT /en/1/apps/[id]
// Request
{ "application":
{
"id": 3,
"name": "App name",
"url": "http://example.com"
"not_listed_in_app_store": 0,
// PUT /en/1/apps/[id]
// Request
{ "application":
{
"id": 3,
"name": "App name",
"url": "http://example.com"
"not_listed_in_app_store": 0,