Skip to content

Instantly share code, notes, and snippets.

@sprohaszka
sprohaszka / gist:549907
Created August 25, 2010 17:26
Multiple version of grails
export GRAILS_HOME=/opt/grails-$1
$GRAILS_HOME/bin/grails $2
#exemple : runGrails 1.3.1 "-Dserver.port=8082 run-app"
@sprohaszka
sprohaszka / gist:549910
Created August 25, 2010 17:27
replace string in files
#!/bin/bash
for file in *.groovy
do
echo "Traitement de $file ..."
sed -e "s/string1/string2/g" "$file" > "$file".tmp && mv -f "$file".tmp "$file"
done
@sprohaszka
sprohaszka / gist:549918
Created August 25, 2010 17:29
Right user mysql
GRANT ALL PRIVILEGES ON Base.* TO userId@'%' IDENTIFIED BY 'Password';
@sprohaszka
sprohaszka / gist:549921
Created August 25, 2010 17:30
Extension file filter
import java.io.File;
import java.util.Vector;
/**
* Filter on the extension of the files.
* @author sprohaszka
*
*/
public class FileExtFilter extends javax.swing.filechooser.FileFilter {
@sprohaszka
sprohaszka / gist:549922
Created August 25, 2010 17:30
Getting HttpServletRequest from RenderRequest
HttpServletRequest httpRequest = (HttpServletRequest) renderRequest.getAttribute(PortletServlet.PORTLET_SERVLET_REQUEST);
@sprohaszka
sprohaszka / UIColor+RGB.m
Created April 28, 2011 13:01
UIColor Category for RGB with value from 0 to 255
@implementation UIColor (RGB)
+ (UIColor*) colorIntWithRed:(int)red green:(int)green blue:(int)blue {
return [UIColor colorWithRed:red/255.0f green:green/255.0f blue:blue/255.0f alpha:1.0f];
}
@end
@sprohaszka
sprohaszka / gist:953098
Created May 3, 2011 10:00
Block for simple comparaison
NSComparisonResult (^sortBlock)(id, id) = ^(id obj1, id obj2) {
// Objects have a name property
NSString* name1 = [obj1 name];
NSString* name2 = [obj2 name];
return [name1 caseInsensitiveCompare:name2];
};
@sprohaszka
sprohaszka / gist:1468989
Created December 12, 2011 20:40
Create list of countries
def countries
Locale.availableLocales.each { locale ->
String iso = locale.getISO3Country()
String code = locale.country
String name = locale.displayCountry
if (iso && code && name) {
Address.@countries += [iso: iso, code: code, name: name]
}
@sprohaszka
sprohaszka / oclint.sh
Created February 7, 2013 11:13
Simple OCLint script
#!/bin/bash
if [ $# -lt 2 ]; then
echo "OCLint generate by default a report.html files with all rules violation"
echo "This script requires that oclint, oclint-xcodebuild and ocline-json-compilation-database can be reached from your PATH"
echo "Usage $0 <workspace> <scheme>"
exit 0
fi
xcodebuild -workspace $1 -sdk iphonesimulator6.1 -scheme $2 clean build | tee xcodebuild.log
@sprohaszka
sprohaszka / gist:5721512
Created June 6, 2013 13:34
Build iOS project into custom DIR
xcodebuild -target "TARGET" -sdk iphoneos6.1 -scheme "SCHEME" CONFIGURATION_BUILD_DIR='temp/' clean build