Skip to content

Instantly share code, notes, and snippets.

View aemkei's full-sized avatar

Martin Kleppe aemkei

View GitHub Profile
$ ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d\ -f2
alias ip="ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d\ -f2"
@aemkei
aemkei / Selenuim for Rails 2.2
Created April 21, 2009 16:36 — forked from ubilabs/Selenuim for Rails 2.2
Selenium for Rails 2.2
# Install Selenium as a plugin:
script/plugin install http://svn.openqa.org/svn/selenium-on-rails/stable/selenium-on-rails/
# Copy configuration file:
cp vendor/plugins/selenium-on-rails/selenium.yml.example config/selenium.yml
# Be sure to setup your browsers. Add this to run Firefox with a clean profile:
# /Applications/Firefox.app/Contents/MacOS/firefox-bin -P selenium
# Optional: Install ThoughtBot Shoulda gem:
@aemkei
aemkei / 0. create local branch
Created April 27, 2009 10:38
push existing local branch to remote
#syntax
git checkout -b name_of_local_branch
#example
git checkout -b experimental
# show a colores list of all your commits
alias timelog='git log --pretty=format:"%Cgreen%ad%Creset: %s%d" --date=local --author=YOUR_NAME_HERE --since="1 weeks ago"'
@aemkei
aemkei / export_png_8_with_alpha.textile
Created May 19, 2009 15:53
Export PNG8 With Alpha

Choose your colors:

  • Open original file in Photoshop
  • Select relevant areas (“Marquee”)
  • Choose: Selection > Save Selection…
  • Enter name eg: “Colors” and hit “Save”

Remove transparent areas:

  • Select layer alpha (“CMD+Click” on layer)
# replace 123 with line number
git blame --porcelain -L123,123 folder/file.ext | grep summary
# replace 123 with you line number
git blame --porcelain -L123,123 folder/file.ext | grep summary
git clone git://github.com/dchelimsky/rspec.git
cd rspec
git checkout 1.1.8
rake gem
rake install_gem
@aemkei
aemkei / PastryKit.js
Created December 16, 2009 11:17 — forked from collin/gist:257557
PastryKit - Apple iPhone Webdev Library
const PKSupportsTouches = ("createTouch" in document);
const PKStartEvent = PKSupportsTouches ? "touchstart" : "mousedown";
const PKMoveEvent = PKSupportsTouches ? "touchmove" : "mousemove";
const PKEndEvent = PKSupportsTouches ? "touchend" : "mouseup";
function PKUtils() {}
PKUtils.assetsPath = "";
PKUtils.t = function (b, a) {
return "translate3d(" + b + "px, " + a + "px, 0)"
};
/*
* #js1k - JavaScript Encoder / Decoder
*
* Simply paste your code and shrink it down to about 50%.
* This algorithm uses Bit-Shifting to pack two chars into one.
* The encoder is included in the output and weights only 89 bytes.
*
* Note: This will reduce the character count only, but not the file size!
*
* by Martin Kleppe <kleppe@gmail.com>