Skip to content

Instantly share code, notes, and snippets.

View mfilej's full-sized avatar

Miha Filej mfilej

View GitHub Profile
@mfilej
mfilej / DebugConfirmTossingUnsubmittedFormText.markdown
Created September 11, 2010 16:02
Get rid of Safari's irritating "Are you sure you want to close this window?" prompt

prompt

Does it look familiar? It is especially annoying with Google Instant because google reloads the results without actually submitting the form and Safari thinks you are about to throw away the input.

To get rid of the prompt open up Terminal and enter the following command:

defaults write com.apple.Safari DebugConfirmTossingUnsubmittedFormText -bool FALSE

Restart safari and reclaim your sanity.

@mfilej
mfilej / fluid-live_timing.css
Created August 24, 2010 22:42
formula1.com live timing fluid userstyles
html {
overflow: hidden;
}
#liveTimingsApplet {
position: absolute !important;
top: 0;
left: -27px;
}
# TODO: switch to thetvdb.com API
require 'open-uri'
require 'hpricot'
BASE_URI = 'http://www.tvrage.com/'
NEXT_EPISODE_SELECTOR = '#iconn2 > td:first-child > table > tr + tr > td + td > span'
def show_uri(name)
"#{BASE_URI}#{name}"
@mfilej
mfilej / chromium_update
Created March 19, 2010 10:48
chromium_update (forked from http://pastie.org/819162)
#!/usr/bin/env ruby
# Script for OS X users to install and run the latest nightly Chromium build
#
# Save as file as "chromium_update" in your $PATH; and chmod +x chromium_update
#
# Written by Dr Nic Williams and Bo Jeanes from Mocra; [email protected]
# Updated by Miha Filej (github.com/mfilej)
require "pathname"
class Array
def bump_duplicates!
current = max.succ
each_with_index do |element, i|
if slice(0...i).include? element
self[i] = current
current = current.succ
end
end
end
@mfilej
mfilej / _.md
Created October 25, 2009 02:15
Copy public iDisk URL from Finder (automator action)

Copy public iDisk URL from Finder

iDisk is not the best user experience Apple has to offer and I hope that they are going to realize that in the near future. One of it's many flaws is the lack of a simple way to get the public URL for a file (without opening the web interface), preferably from the Finder.

This is a script for Automator. Create a new service and select "Service receives selected Files or folders in Finder". Add the "Run shell script" action from the library and insert the code from convert_path_to_idisk_url.rb. Save as "Copy public URL".

Open Finder, select a file, go to Finder ➞ Services ➞ Copy as public URL.

You have to wait for the script to execute, it can take a second or two. There is no feedback when the script is done.

@mfilej
mfilej / now_playing.sh
Created October 17, 2009 17:46
get the current song from iTunes
#! /bin/sh
# mostly from http://www.macosxhints.com/article.php?story=2004070301135736
# using with GeekTool
if ps x \
| grep [/]Applications/iTunes.app/Contents/MacOS/iTunes \
> /dev/null; then
osascript - <<'OSASCRIPT'
@mfilej
mfilej / grid_overlay.js
Created October 11, 2009 18:14
toggle the visibility of a grid to aid setting the vertical rhythm
// depends on prototype and http://mislav.uniqpath.com/js/c-is-for-cookie/
document.observe('dom:loaded', function() {
var gridOverlay = $('grid-overlay')
if (!gridOverlay) return
if (Cookie.get('gridOverlay') == "true") gridOverlay.show()
var toggleGrid = function() {
var visible = this.toggle().visible()
Cookie.set('gridOverlay', visible, { path: '/' })
@mfilej
mfilej / sample_output.txt
Created October 2, 2009 14:23
fetch next episode info from tvrage.com
Lie to Me episode 15: 2x02 -- Truth or Consequences is airing on 2009-10-05
Mad Men episode 34: 3x08 -- Souvenir is airing on 2009-10-04
The Big Bang Theory episode 43: 3x03 -- The Gothowitz Deviation is airing on 2009-10-05
@mfilej
mfilej / my.cnf
Created September 3, 2009 16:05
mysql config for os x
[client]
socket = /var/run/mysqld/mysqld.sock
user = root
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
[mysqld]
user = miha
datadir = /Users/miha/Library/Databases/mysql