Skip to content

Instantly share code, notes, and snippets.

View ralfebert's full-sized avatar

Ralf Ebert ralfebert

View GitHub Profile
@ralfebert
ralfebert / .bashrc
Created August 9, 2010 19:16
git settings
# Prompt (Debian)
source /usr/local/bin/git-completion.sh
# Prompt (OS X + homebrew)
source /usr/local/etc/bash_completion.d/git-completion.bash
PS1="\[\033[31;38m\]\w\[\033[1;31m\]\$(__git_ps1)\[\033[00m\] "
export GIT_PS1_SHOWDIRTYSTATE=1
@ralfebert
ralfebert / p2.inf (http)
Created August 26, 2010 11:15
example p2.inf
instructions.configure=\
addRepository(type:0,location:http${#58}//localhost:1234/repository/);\
addRepository(type:1,location:http${#58}//localhost:1234/repository/);
@ralfebert
ralfebert / gist:1255969
Created October 1, 2011 12:17
Ruby String helpers: indent, to_javadoc, markdown, pygmentize
# Placed in Public Domain by Ralf Ebert, 2008
#
# THIS SOFTWARE IS PROVIDED BY Ralf Ebert ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Ralf Ebert BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// For example:
// UIColorFromRGBA(0xffee00, 0.5)
// UIColorFromRGB(0xffee00)
static inline UIColor *UIColorFromRGBA(int rgb, float a) {
return [UIColor colorWithRed:((float)((rgb & 0xFF0000) >> 16))/255.0
green:((float)((rgb & 0xFF00) >> 8))/255.0
blue:((float)(rgb & 0xFF))/255.0 alpha:a];
}
@ralfebert
ralfebert / values.gnuplot
Created April 4, 2013 16:51
Plotting and fitting values to a linear equation from CSV data with gnuplot
set datafile separator ';'
set terminal png
set output 'values.png'
f(x) = a*x + b
fit f(x) 'values.csv' using 1:2 via a, b
plot 'values.csv' using 1:2, f(x) title sprintf('%.2fx + %.2f', a, b)
@ralfebert
ralfebert / gist:5382822
Last active December 16, 2015 05:09
git config core.editor
git config --global core.editor "nano -Y patch"
git config --global core.editor "'C:\Program Files (x86)\Notepad++\notepad++.exe' \
-multiInst -notabbar -nosession -noPlugin"
git config --global core.editor "gedit -w -s"
git config --global core.editor "mate -w"
@ralfebert
ralfebert / gist:5425624
Created April 20, 2013 11:03
git alias.clear resets working tree to HEAD
git config --global alias.clear '!git reset --hard;git clean -fd'
git config --global alias.lg "log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr %an)%Creset' --abbrev-commit --date=relative"
@ralfebert
ralfebert / swift-kvo-example.swift
Last active October 18, 2020 21:41 — forked from correia/swift-kvo-example.swift
Swift 1.1: dynamic for observable properties neccessary, observeValueForKeyPath signature changed
//
// Swift-KVO
//
// Created by Jim Correia on 6/5/14.
// Copyright (c) Jim Correia. All rights reserved.
//
// Update: 6/17/2014
//
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context
From 5366b677f1f7a1053de5904f96ba5108ffaf8953 Mon Sep 17 00:00:00 2001
From: Ralf Ebert <info@ralfebert.de>
Date: Thu, 7 May 2015 23:33:01 +0200
Subject: [PATCH] Fix for #844: Incompatibility haml (4.0.6) -> sprockets
(3.0.3) causing error 'wrong number of arguments' for inline :sass filter in
haml template
---
lib/haml/sass_rails_filter.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)