Skip to content

Instantly share code, notes, and snippets.

View tomgco's full-sized avatar
☠️
Building stuff

Tom Gallacher tomgco

☠️
Building stuff
View GitHub Profile
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@Sut3kh
Sut3kh / reset_windows.scpt
Created March 2, 2012 16:20
Reset all windows to primary screen for the given application
set _app to text returned of (display dialog "Reset application: " default answer "Google Chrome")
set _offset to 30
set x_start to 100
set y_start to 15
set _width to 1550
set _height to 1000
set new_col_at to 3
tell application _app
set last_x to (_offset * (count windows)) + x_start
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@stefansundin
stefansundin / install-kbd-backlight.sh
Last active June 9, 2024 10:25
Script to control keyboard backlight brightness on a Chromebook Pixel running Ubuntu. Includes extra bits like restore old session value on boot, dim keyboard on screen lock, restoring value when resuming from suspend, and so on. Relies on kernel module acpi_call (instructions below).
#!/bin/sh
# This script will install the files below.
# Please look through them first so you know what will happen.
# Install by running this command:
# curl -fL https://gist.githubusercontent.com/stefansundin/7003429/raw/install-kbd-backlight.sh | sh
# Uninstall with:
# sudo rm /opt/kbd-{backlight,lock}.sh /etc/pm/sleep.d/70-kbd-backlight
# rm ~/.config/autostart/kbd-{backlight,lock}.sh.desktop