Skip to content

Instantly share code, notes, and snippets.

View svenwin's full-sized avatar

Sven Winkler svenwin

View GitHub Profile
@svenwin
svenwin / bb_reviews.js
Created January 23, 2018 14:12
Bitbucket Reviews
// ==UserScript==
// @name Bitbucket Approver
// @namespace http://tampermonkey.net/
// @version 0.3.1
// @description Fades out already approved commits …
// @author Sven Winkler
// @include https://bitbucket.org/*
// @grant none
// @updateURL https://gist.githubusercontent.com/svenwin/f89d122680e452e6ab24ae27ded589e3/raw
// ==/UserScript==
@svenwin
svenwin / private.xml
Created August 19, 2016 15:13
Remap Lenovo USB to Mac
<?xml version="1.0"?>
<root>
<item>
<name>Lenovo USB for Mac</name>
<item>
<name>Remap CMD + Alt (sticky)</name>
<identifier>remap.print_to_option_r</identifier>
<device_only>DeviceVendor::RawValue::0x17ef, DeviceProduct::RawValue::0x6047</device_only>
<autogen>__KeyOverlaidModifier__ KeyCode::OPTION_R, KeyCode::COMMAND_R, KeyCode::VK_STICKY_ACTIVE_MODIFIERS_FORCE_ON, KeyCode::VK_STICKY_COMMAND_R</autogen>
<autogen>__KeyOverlaidModifier__ KeyCode::F13, KeyCode::OPTION_R, KeyCode::VK_STICKY_ACTIVE_MODIFIERS_FORCE_ON, KeyCode::VK_STICKY_OPTION_R</autogen>
@svenwin
svenwin / medium.xml
Last active July 15, 2016 07:09
Make medium shortcuts ⌘⌥5 and ⌘⌥6 usable on a german keyboard layout
<?xml version="1.0"?>
<root>
<item>
<name>Medium for german keyboard layout</name>
<item>
<name>Make CMD+ALT+5,6 useable</name>
<only>GOOGLE_CHROME</only>
<identifier>remap.medium_keys</identifier>
<autogen>__KeyToKey__ KeyCode::5, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND | MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, KeyCode::KEYPAD_5, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::6, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND | MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, KeyCode::KEYPAD_6, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L</autogen>
@svenwin
svenwin / cmd_to_ctrl.xml
Last active December 10, 2015 22:59
KeyRemap private.xml Switch Cmd to Ctrl on Terminal
<?xml version="1.0"?>
<root>
<item>
<name>SW: Avoid Terminal-RSI</name>
<appendix>Get two new big CTRL buttons for your thumbs</appendix>
<item>
<name>Swap Command_R with Control_R</name>
<identifier>remap.app_terminal_commandR2controlR</identifier>
<only>TERMINAL</only>
<autogen>--KeyToKey-- KeyCode::COMMAND_R, KeyCode::CONTROL_R</autogen>
#!/bin/sh
#
# This shell script passes all its arguments to the binary inside the
# MacVim.app application bundle. If you make links to this script as view,
# gvim, etc., then it will peek at the name used to call it and set options
# appropriately.
#
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic. This
# version is the fault of Benji Fisher, 16 May 2005 (with modifications by Nico
# Weber and Bjorn Winckler, Aug 13 2007).
@svenwin
svenwin / rvm_after_cd_hook_bundle_exec
Created September 3, 2011 10:28
RVM after_cd hook for bundle exec
# you will need to "export rvm_verbose_flag=" after using "rvm use" to shutup verbose Hook message
path_prepend () { path_remove $1; export PATH="$1:$PATH"; }
path_remove () { export PATH=`echo -n $PATH | awk -v RS=: -v ORS=: '$0 != "'$1'"' | sed 's/:$//'`; }
if [[ -f "Gemfile" && -d "bin" ]]; then
[ ! -z "$gemfiled_project_path" ] && path_remove ${gemfiled_project_path}/bin
export gemfiled_project_path=`pwd`
path_prepend ${gemfiled_project_path}/bin
echo "Bundler binstubs is in $gemfiled_project_path/bin" 1>&2
#!/usr/bin/env ruby
# in reference to http://tammersaleh.com/posts/the-modern-vim-config-with-pathogen
git_bundles = [
"git://github.com/astashov/vim-ruby-debugger.git",
"git://github.com/msanders/snipmate.vim.git",
"git://github.com/scrooloose/nerdtree.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-cucumber.git",
"git://github.com/tpope/vim-fugitive.git",
@svenwin
svenwin / clean_close.vim
Created May 12, 2011 16:59
vim clean close, preserve my splits
map fc <Esc>:call CleanClose()
function! CleanClose()
let todelbufNr = bufnr("%")
let newbufNr = bufnr("#")
if ((newbufNr != -1) && (newbufNr != todelbufNr) && buflisted(newbufNr))
exe "b".newbufNr
else
bnext
endif
rake routes | awk 'NR>1{gsub("^[^/]*", "");r[$1]=0} END{for(i in r)print i}' | sort
@svenwin
svenwin / default_value_for
Created February 3, 2011 09:33
attributes are set at the end
def initialize_with_defaults(attrs = nil)
initialize_without_defaults() do
if attrs
stringified_attrs = attrs.stringify_keys
safe_attrs = sanitize_for_mass_assignment(stringified_attrs)
safe_attribute_names = safe_attrs.keys.map do |x|
x.to_s
end
end
self.class._default_attribute_values.each do |attribute, container|