Skip to content

Instantly share code, notes, and snippets.

View mikker's full-sized avatar
👋

Mikkel Malmberg mikker

👋
View GitHub Profile
@mikker
mikker / hidemyass.com.js
Created November 13, 2012 13:05
Instantly submit the form on hidemyass.com
1 /*
2 * Instantly submit the form on hidemyass.com
3 * For use with Safari Keyword Searches etc.
4 * ---
5 * Setup this keyword search:
6 * http://hidemyass.com/proxy/index.php?site=http://@@@
7 */
8 $(function(){
9 // Auto-submit form if filled in already
10 if ($("#hmaurl").attr("value") != "http://google.com")
@mikker
mikker / fnmatch_bracket_hack.rb
Last active December 10, 2015 20:08
Hack File.fnmatch to support braces eg. "*.{ht,x}ml"
# Hack File.fnmatch to support braces
# eg. "*.{ht,x}ml"
class ::File
class << self
alias :_fnmatch :fnmatch
def fnmatch(pattern, path, flags = 0)
regex = /\{(.+)\}/i
# Look for braces
if match = pattern.match(regex)
@mikker
mikker / NebulousMacros.txt
Created March 1, 2013 17:24
My NebulousNotes macros
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<string>$select</string>
<string> ⚫⚪ </string>
</array>
<array>
<string>[$sel]($paste)$cursor</string>
@mikker
mikker / firmafon.rb
Created March 5, 2013 16:12
Something I use everyday.
#!/usr/bin/env ruby
# In the morning:
# $ firmafon
# In the afternoon
# $ firmafon -q
apps = %w{BreakTime Fogbugz HipChat FirmafonApps}
def bracketize(str = "")
@mikker
mikker / nb.sh
Created May 23, 2013 11:52
Checkout new (or existing) branch of name $1 -- with completion
nb() {
if [[ $(git branch | tr -d '* ' | grep "$1") != "" ]]; then
git checkout $1
else
git checkout -b $1
fi
}
_nb() { reply=($(git branch | tr -d '* ' | xargs echo)) }
compctl -K _nb nb
@mikker
mikker / gist:6965835
Created October 13, 2013 18:46
Bookmarklet: Copy the URL of the current page and return - using Drafts for iOS
var a=encodeURI(window.location.href);window.location='drafts://x-callback-url/create?text='+a+'&action=Copy%20to%20Clipboard&x-success='+a;
@mikker
mikker / config.ru
Created December 30, 2013 13:14
The littlest Rack GET proxy
require 'rack'
require './littlest_proxy'
run Rack::URLMap.new("/proxy" => LittlestProxy.new("http://google.com"))
# /proxy?path=/search => http://google.com/search
@mikker
mikker / open_reading_list_in_tabs.rb
Last active August 31, 2019 09:00
Open all links in Safari's Reading List in tabs.
#!/usr/bin/env ruby
# $ gem install CFPropertyList
require 'cfpropertylist'
path = File.expand_path '~/Library/Safari/Bookmarks.plist'
plist = CFPropertyList::List.new file: path
list = plist.value.value["Children"].value.select do |item|
if title = item.value["Title"]
title.value == 'com.apple.ReadingList'
@mikker
mikker / github.css
Last active March 2, 2017 08:57
Naively responsive GitHub
/**
* Naively responsive GitHub
* For use with something like
* Safari: http://sobolev.us/stylish/ or
* Chrome: https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en
*/
body { min-width: 300px !important; }
.header { min-width: 300px !important; }
.container { width: 100%; padding-left: 10px; padding-right: 10px; }
.columns { margin-left: 0; margin-right: 0; }