Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tom Raithel tomraithel

🏠
Working from home
View GitHub Profile
@tomraithel
tomraithel / gist:2006848
Created Mar 9, 2012
Java: Call Method via Reflection
View gist:2006848
@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 Mar 9, 2012
Java: Simple Date Format
View gist:2007425
Date dt = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm");
setTest(df.format(dt));
@tomraithel
tomraithel / gist:3502418
Created Aug 28, 2012
SASS | CSS: clearfix
View gist:3502418
@mixin clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
@tomraithel
tomraithel / gist:3803731
Created Sep 29, 2012
RUBY: Round number and strip trailing zeros
View gist:3803731
"%g" % ("%0.2f" % 16.4555)
@tomraithel
tomraithel / gist:3845330
Created Oct 6, 2012
CSS: @font-face definition for all browsers
View gist:3845330
@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 Oct 8, 2012
SASS: mixin for absolute center position
View gist:3852171
@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 Nov 12, 2012 — forked from wolfeidau/sass_converter.rb
Sass plugin for Jekyll
View sass_converter.rb
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 Nov 13, 2012 — forked from phaer/coffeescript_converter.rb
JEKYLL: Coffeescript converter plugin
View coffeescript_converter.rb
# 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 Nov 16, 2012
CSS: Image Replacement (zero font size)
View gist:4085419
.ir {
font: 0/0 a;
text-shadow: none;
color: transparent;
}
@tomraithel
tomraithel / gist:4085420
Created Nov 16, 2012
NODE: Run Server on Shell with nohup
View gist:4085420
nohup node app.js &
ps -ef | grep "app.js"