Skip to content

Instantly share code, notes, and snippets.

@Grayson
Grayson / isOptionKeyPressed.scpt
Created August 18, 2011 14:03
Applescript snippet to test if Option key is held down.
on isOptionKeyPressed()
return (do shell script "/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSAlternateKeyMask > 1'") is "True"
end isOptionKeyPressed
@casschin
casschin / gist:1990245
Created March 7, 2012 01:16
Python webdriver api quick sheet
### Locating UI elements ###
# By ID
<div id="coolestWidgetEvah">...</div>
element = driver.find_element_by_id("coolestWidgetEvah")
or
from selenium.webdriver.common.by import By
element = driver.find_element(by=By.ID, value="coolestWidgetEvah")
# By class name:
@pmdarrow
pmdarrow / gist:3427827
Created August 22, 2012 17:40
How to compile wkhtmltopdf static binary on Ubuntu 12.04
# These instructions were tested on Ubuntu 12.04 64bit
# Be prepared to wait a while...
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev libxext-dev libpq-dev libx11-dev
git clone git://github.com/antialize/wkhtmltopdf.git
git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt
cd wkhtmltopdf
mkdir static-build
ln -s ../wkhtmltopdf-qt static-build/qt
./scripts/static-build.sh
@snowman-repos
snowman-repos / gist:3838104
Created October 5, 2012 04:31
SASS: Font Stack
@mixin font-stack-brand {
font-family: 'Gotham Rounded A', 'Gotham Rounded B', "proxima-nova-soft", sans-serif;
}
@mixin font-stack-headers {
font-family: 'Whitney Cond A', 'Whitney Cond B', "ronnia-condensed", sans-serif;
font-weight: 700;
font-style: normal;
}
@mixin font-stack-body {
font-family: 'Whitney SSm A', 'Whitney SSm B', "ff-meta-web-pro", sans-serif;
@zed
zed / progressbar-nothreads.py
Created November 13, 2012 18:47
start/stop tkinter progressbar on start/end of a subprocess without using threads
import sys
from subprocess import Popen
from Tkinter import Tk, StringVar
import ttk
START, STOP = "start", "stop"
# just some arbitrary command for demonstration
cmd = [sys.executable, '-c', """import sys, time
print("!")
@martinnormark
martinnormark / PopoverView.js
Last active November 29, 2016 10:58
Backbone implementation of the Twitter Bootstrap Popover view
(function () {
App.Views.PopoverView = Backbone.View.extend({
initialize: function (options) {
_.bindAll(this, "render", "setContent", "show", "hide", "toggle", "destroy", "remove");
this.offsetTop = 30;
this.offsetLeft = 0;
@Aerilius
Aerilius / sips.sh
Created January 17, 2013 17:37
A shell script to translate Apple's SIPS (scriptable image processing system) commands to ImageMagick. It can be used to test software that depends on SIPS (and thus the proprietary Core Image) on any other unixoid system, ie. Linux.
#!/bin/bash
# This script translates some SIPS (scriptable image processing system) commands to ImageMagick.
# http://www.unix.com/man-page/all/1/sips
input=""
output=""
convertoption=""
while :
do
@iambibhas
iambibhas / scopes.txt
Last active June 16, 2024 20:45
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@timpulver
timpulver / GetNameAndTitleOfActiveWindow.scpt
Created February 11, 2013 10:38
[AppleScript] Get Name of active window | Returns the name / title of the active (frontmost) window
# taken from user Albert's answer on StackOverflow
# http://stackoverflow.com/questions/5292204/macosx-get-foremost-window-title
# tested on Mac OS X 10.7.5
global frontApp, frontAppName, windowTitle
set windowTitle to ""
tell application "System Events"
set frontApp to first application process whose frontmost is true
set frontAppName to name of frontApp
@aortbals
aortbals / dispatch.py
Last active October 20, 2023 16:09
Synchronize two folders using python.
#! /usr/bin/python
# Dispatch - synchronize two folders
import os
import filecmp
import shutil
from stat import *
class Dispatch:
''' This class represents a synchronization object '''