This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.toggleAttr = (attr, bool) -> | |
if bool | |
return @attr attr, attr | |
if typeof bool isnt 'undefined' | |
return @removeAttr attr | |
@each -> | |
$e = $ @ | |
if typeof $e.attr(attr) is 'undefined' | |
$e.attr attr, attr | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the bounds of elements including all children relative to the document | |
# - The visibility property is totally ignored whether visible or hidden | |
# - Elements with display: none are skipped | |
# - Horizontal bounds of children are ignored when overflow-x is hidden | |
# - Vertical bounds of children are ignored when overflow-y is hidden | |
$.fn.getBounds = -> | |
bounds = | |
left: Infinity | |
right: -Infinity | |
top: Infinity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleDragMove = (dx, dy, mouseX, mouseY) -> | |
angleEllipse = $canvas.data 'rotation' | |
centreToMouseX = mouseX - ($canvas.offset().left + ellipse.attr('cx')) | |
centreToMouseY = mouseY - ($canvas.offset().top + ellipse.attr('cy')) | |
centreToMouse = Math.sqrt(Math.pow(centreToMouseX, 2) + Math.pow(centreToMouseY, 2)) | |
angleMouse = Math.atan2(centreToMouseY, centreToMouseX) | |
if @data 'horizontal' | |
updateShapes | |
rx: Math.abs(centreToMouse * Math.cos(angleMouse - angleEllipse)) | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd"> | |
<!--Created by Ukelele version 2.2.4 on 2013-05-21 at 12:51 (PDT)--> | |
<!--Last edited by Ukelele version 2.2.4 on 2013-05-21 at 13:33 (PDT)--> | |
<keyboard group="0" id="5591" name="GB Dvorak" maxout="1"> | |
<layouts> | |
<layout first="0" last="0" modifiers="f4" mapSet="a14"/> | |
<layout first="18" last="18" modifiers="f4" mapSet="1fc"/> | |
<layout first="21" last="23" modifiers="f4" mapSet="1fc"/> | |
<layout first="30" last="30" modifiers="f4" mapSet="1fc"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fadefactor is a short method which returns a float based on the one passed in | |
# audio is a bytearray | |
for i in range(fadeinframes): | |
offset = i * framesize | |
frame = str(audio[offset:offset + framesize]) | |
value = struct.unpack(frameformat, frame) | |
audio[offset:offset + framesize] = struct.pack(frameformat, | |
*(fadefactor(float(i) / fadeinframes) * v for v in value)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This has moved to https://github.com/tremby/pulse-volume |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# aa -- view album art | |
# Expects either no argument (and will then query for the currently playing | |
# song according to MPD) or one argument which is the path to a music file. | |
# | |
# Expects to find a file titled something like cover.jpg (see prefixes, | |
# middles, suffixes below) in the same directory as the music file. If found an | |
# image viewer is launched. If no DISPLAY is available, use img2txt to get | |
# ASCII art if available. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import subprocess | |
import pygtk | |
import gtk | |
class Chooser: | |
def __init__(self): | |
self.win = gtk.Window(gtk.WINDOW_TOPLEVEL) | |
self.win.connect("delete_event", self.quit) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WPDIR="$HOME/images/wallpaper" | |
random=true | |
apply=true | |
wpfile="" | |
function usage { | |
if [ $1 -eq 1 ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check for binaries | |
type -P xmousepos &>/dev/null || { | |
echo "can't find xmousepos -- install xautomation" >&2 | |
exit 1 | |
} | |
type -P xte &>/dev/null || { | |
echo "can't find xte -- install xautomation" >&2 | |
exit 1 |