Skip to content

Instantly share code, notes, and snippets.

View tomraithel's full-sized avatar
🏠
Working from home

Tom Raithel tomraithel

🏠
Working from home
View GitHub Profile
@tomraithel
tomraithel / gist:4475011
Created January 7, 2013 13:34
js | coffeescript: German number format
= (number) ->
stringReverse = (str)->
str.split('').reverse().join('')
[preComma, postComma] = number.toFixed(2).split('.')
preComma = stringReverse(stringReverse(preComma).match(/.{1,3}/g).join('.'))
"#{preCom
@tomraithel
tomraithel / gist:4089124
Created November 16, 2012 17:17
SVN | BASH: Autmatically remove all missing files from SVN
# to add it as alias use:
# alias svn_remove='svn status | sed -Ee '\''/^!/!d'\'' -e '\''s/^! *(.*)/"\1"/g'\'' | xargs -L1 svn rm'
svn status | sed -Ee '/^!/!d' -e 's/^! *(.*)/"\1"/g' | xargs -L1 svn rm
@tomraithel
tomraithel / gist:4085483
Created November 16, 2012 08:31
RUBY: A Rakefile for creating a zip from files within a directory
require 'rake/packagetask'
namespace :my_namespace do
desc "Make coffee"
task :make_coffee do
cups = ENV["COFFEE_CUPS"] || 2
puts "Made #{cups} cups of coffee. Shakes are gone."
end
# see http://rake.rubyforge.org/classes/Rake/PackageTask.html
@tomraithel
tomraithel / gist:4085482
Created November 16, 2012 08:31
CSS: Prevent iPad tap highlight
-webkit-tap-highlight-color:rgba(0,0,0,0);
@tomraithel
tomraithel / gist:4085481
Created November 16, 2012 08:30
HTML + CSS: A flipbook-like animation with CSS3
<div class="flipbook">
<div class="page left leftpage">
<div class="pagewrap">
<div class="page_content">
Dies ist die erste Seite des flipbooks
</div>
</div>
</div>
<div class="page center">
<div class="innerpage rightpage inner_right">
@tomraithel
tomraithel / gist:4085477
Created November 16, 2012 08:29
SASS: Create custom functions with a SASS plugin
# A sass plugin to calculate colums width based on a 100% width, the colspan and the spacing amount.
#
# Apply this plugin by passing it to the sass command as a require parameter:
# >> sass --require ts_sass_functions.rb
#
# @copyright triplesense
# @author Tom Raithel
# @version 1.0
# @package com.vorwerk.corporate
#
@tomraithel
tomraithel / gist:4085474
Created November 16, 2012 08:29
SUBLIME: Custom build command
{
"cmd": ["my_custom_bat.bat"],
"encoding": "cp850",
"working_dir": "C:/dev/path-to/batch/",
"variants": [
{
"cmd": ["solve_world_hunger"],
"name": "Solve World Hunger" // Searchable in command pallette
},
@tomraithel
tomraithel / gist:4085466
Created November 16, 2012 08:28
JS: normalize a page number to match a valid page in a looping carrousel / slider
_getNormalizedPage: function(page) {
if(page < 0) {
return this.pages.length + (page % this.pages.length)
}
return page % this.pages.length;
}
@tomraithel
tomraithel / gist:4085463
Created November 16, 2012 08:28
SUBLIME: Eclipse-like key bindings (MAC)
[
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+shift+j"], "command": "join_lines" },
{ "keys": ["super+alt+down"], "command": "duplicate_line" },
{ "keys": ["shift+super+r"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["super+shift+s"], "command": "save_all" },
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
@tomraithel
tomraithel / gist:4085460
Last active October 12, 2015 20:48
SUBLIME: Create a snippet
<snippet>
<!-- Save this file in ~\Library\Application Support\Sublime Text 2\Packages\User\whatevername.sublime-snippet -->
<content><![CDATA[
<a class="button-lookalike ${1:primary} green" data-iconclass="buttoniconright arrow-right" href="${2:#}">${3:link}</a>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>ts.button</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>*.html</scope> -->
</snippet>