Skip to content

Instantly share code, notes, and snippets.

View gr4y's full-sized avatar

Sascha Wessel gr4y

View GitHub Profile
@gr4y
gr4y / gist:5517010
Created May 4, 2013 09:53
How I setup my ruby environment:
#
# This is the way I configured my ruby environment on ArchLinux.
#
# I don't like the overhead of rvm, so I use chruby to switch between ruby versions.
# So first you need to install chruby from source:
#
# https://github.com/postmodern/chruby#install
#
# To build ruby from source I use ruby-build, so after chruby we install ruby-build:
#
@gr4y
gr4y / dabblet.css
Created February 21, 2013 22:18
Pretty CSS "Stiched" look
/**
* Pretty CSS "Stiched" look
* inspired by http://css-tricks.com/snippets/css/stitched-look/
*/
body {
margin: 0;
}
.text {
@gr4y
gr4y / dabblet.css
Created February 21, 2013 22:11
Pretty CSS "Stiched" look
/**
* Pretty CSS "Stiched" look
* inspired by http://css-tricks.com/snippets/css/stitched-look/
*/
body {
margin: 0;
}
.text {
@gr4y
gr4y / example_a.java
Created September 25, 2012 09:42
Let's guess what's easier and cleaner code. Example A or Example B?
final ByteArrayOutputStream out = new ByteArrayOutputStream();
...
try {
wb.write(out);
} catch (final IOException e) {
throw new DocumentBuilderException(e);
}
return out.toByteArray();
...
@gr4y
gr4y / gist:3247122
Created August 3, 2012 12:28
Handling mouseover with Selenium. How it doesn't work!
// this doesn't work
final Locatable hoverItem = (Locatable) element;
final Mouse mouse = ((HasInputDevices) driver).getMouse();
mouse.mouseMove(hoverItem.getCoordinates());
// this doesn't work too
Actions builder = new Actions(driver);
builder.moveToElement(element).build().perform();
// executing javascript doesn't work either.
@gr4y
gr4y / gist:2387672
Created April 14, 2012 20:05
allow only numbers in UITextField. For now without currency!
- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSCharacterSet *nonNumberSet = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789."] invertedSet];
BOOL result = NO;
if([string length] == 0){ //backspace
result = YES;
}
else{
@gr4y
gr4y / deployer.rake
Created April 1, 2012 09:12 — forked from morgoth/deployer.rake
Rake task to copy local files to remote server via FTP
# Rake task to copy local files to remote server via FTP
# required credentials.yml file, that contains keys:
# server, username, password
require "net/ftp"
require "yaml"
class FTPClient
attr_reader :remote_path
@gr4y
gr4y / dabblet.css
Created February 10, 2012 14:25
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
}
@gr4y
gr4y / dabblet.css
Created February 10, 2012 10:42
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
font-family: "Arial Bold";
@gr4y
gr4y / dabblet.css
Created February 6, 2012 13:45
is there a css parent selector? the answer is: no.
/**
* is there a css parent selector? the answer is: no.
*/
$ul > li {
background: green;
}
body {