Skip to content

Instantly share code, notes, and snippets.

View derekgates's full-sized avatar

Derek Gates derekgates

View GitHub Profile
@artero
artero / launch_sublime_from_terminal.markdown
Last active September 12, 2024 02:13 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

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

@jterk
jterk / gist:564613
Created September 3, 2010 21:39
I use this script to save and restore window positions on OS X when attaching and removing an external monitor.
#!/usr/bin/env ruby
require 'appscript'
include Appscript
DATA_FILE = File.expand_path "~/.saved_windows"
# Adium is very special.
ADIUM = "Adium"
ADIUM_CONTACTS = "Contacts"
# powershell script for syncing a mercurial repository with a git repository.
# Usage: HgSync.ps1 NameOfProject git://github.com/Path/To/RemoteGitRepo.git https://Path/To/RemoteHgRepository
# Requires the hg-git plugin http://hg-git.github.com/
$project = $args[0]
$gitrepo = $args[1]
$hgrepo = $args[2]
$path = "D:\hg-sync\$project"
function hg {
task GetBuildNumber {
$version = gc $base_directory\$solution_name\Properties\AssemblyInfo.cs | select-string -pattern "AssemblyVersion"
$version -match '^\[assembly: AssemblyVersion\(\"(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<revision>[0-9]+)\.(?<build>[0-9]+)\"\)\]' | Out-Null
"##teamcity[buildNumber '{0}.{1}.{2}.{3}']" -f $matches["major"],$matches["minor"],$matches["revision"],$matches["build"]
}