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:2006848
Created March 9, 2012 14:54
Java: Call Method via Reflection
@Test
public void testRef() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException,
SecurityException, NoSuchMethodException {
RefTest instance = new RefTest();
Class params[] = {};
Method thisMethod = RefTest.class.getDeclaredMethod("getA", params);
String s = thisMethod.invoke(instance, new Object[0]).toString();
Assert.assertEquals("b", s);
}
@tomraithel
tomraithel / gist:2007425
Created March 9, 2012 16:43
Java: Simple Date Format
Date dt = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm");
setTest(df.format(dt));
@tomraithel
tomraithel / gist:3502418
Created August 28, 2012 19:00
SASS | CSS: clearfix
@mixin clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
@tomraithel
tomraithel / gist:3803731
Created September 29, 2012 11:23
RUBY: Round number and strip trailing zeros
"%g" % ("%0.2f" % 16.4555)
@tomraithel
tomraithel / gist:3845330
Created October 6, 2012 16:06
CSS: @font-face definition for all browsers
@font-face {
font-family: "PlutoSansCondexLight";
src: url("plutosanscondexlight.eot"); /* IE9 Compat Modes */
src: url("plutosanscondexlight.eot?iefix") format("eot"), /* IE6-IE8 */
url("plutosanscondexlight.woff") format("woff"), /* Modern Browsers */
url("plutosanscondexlight.ttf") format("truetype"), /* Safari, Android, iOS */
url("plutosanscondexlight.svg#PlutoSansCondexLight") format("svg"); /* Legacy iOS */
font-weight: normal;
font-style: normal;
}
@tomraithel
tomraithel / gist:3852171
Created October 8, 2012 12:05
SASS: mixin for absolute center position
@mixin center($width, $height) {
position: absolute;
left: 50%;
top: 50%;
height: $height;
width: $width;
margin-left: - $width / 2;
margin-top: - $height / 2;
}
@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)
@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 / 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 / gist:4085420
Created November 16, 2012 08:21
NODE: Run Server on Shell with nohup
nohup node app.js &
ps -ef | grep "app.js"