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:4085449
Created November 16, 2012 08:26
RUBY: Copy files from one directory into another
require 'fileutils'
# specify files which should not be copied
dont_copy = ['jquery.languageTags.js']
puts "Copying files from FE to BE folder"
from_dir = "./../FE/templates/global"
to_dir = "./../BE/trunk/htdocs/fileadmin/templates/global"
@tomraithel
tomraithel / gist:4085444
Created November 16, 2012 08:25
JS: IE7 multiple class fix
(function($) { // jQuery no conflict container
"use strict"; // strict mode on!
new function() { // class container
// map this to that (to use this in anonymous functions)
var that = this;
// fires initial Event...
@tomraithel
tomraithel / gist:4085441
Created November 16, 2012 08:25
SUBLIME: Eclipse-like key bindings
[
{ "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+alt+j"], "command": "join_lines" },
{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" },
{ "keys": ["shift+ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+shift+s"], "command": "save_all" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{ "keys": ["shift+ctrl+f4"], "command": "close_all" },
@tomraithel
tomraithel / gist:4085430
Created November 16, 2012 08:23
JS: Multiline RegEx to cut out body contents
// .* does not work because it can not handle multi line
var regex = /<body.*?>([\s\S]*)<\/body>/igm;
regex.exec(data);
data = RegExp.$1;
@tomraithel
tomraithel / gist:4085424
Created November 16, 2012 08:22
JS: regex replace all whitespaces with dash
"asdf a asdfsad".replace(/\s+/g, "-");
@tomraithel
tomraithel / gist:4085422
Created November 16, 2012 08:22
SASS - Div with background and flexible main area
$paddingHeight: 50px;
background: transparent url(../img/b2b-content-middle.png) repeat-y;
min-height: 400px;
padding: 30px 30px 0 30px;
margin-bottom: $paddingHeight;
position: relative;
.main-content {
&:before,
&:after {
@tomraithel
tomraithel / gist:4085420
Created November 16, 2012 08:21
NODE: Run Server on Shell with nohup
nohup node app.js &
ps -ef | grep "app.js"
@tomraithel
tomraithel / gist:4085419
Created November 16, 2012 08:20
CSS: Image Replacement (zero font size)
.ir {
font: 0/0 a;
text-shadow: none;
color: transparent;
}
@tomraithel
tomraithel / coffeescript_converter.rb
Created November 13, 2012 09:57 — forked from phaer/coffeescript_converter.rb
JEKYLL: Coffeescript converter plugin
# Put this file in '_plugins/' and write a YAML header to your .coffee files (i.e. "---\n---\n")
module Jekyll
require 'coffee-script'
class CoffeeScriptConverter < Converter
safe true
priority :normal
def matches(ext)
ext =~ /coffee/i
end
@tomraithel
tomraithel / sass_converter.rb
Created November 12, 2012 09:52 — forked from wolfeidau/sass_converter.rb
Sass plugin for Jekyll
module Jekyll
# Sass plugin to convert .scss to .css
#
# Note: This is configured to use the new css like syntax available in sass.
require 'sass'
class SassConverter < Converter
safe true
priority :low
def matches(ext)