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: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 / 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:3803731
Created September 29, 2012 11:23
RUBY: Round number and strip trailing zeros
"%g" % ("%0.2f" % 16.4555)
@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: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: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);
}