Skip to content

Instantly share code, notes, and snippets.

View gedankennebel's full-sized avatar
🏠
Working from home

Najum Ali gedankennebel

🏠
Working from home
View GitHub Profile
@gedankennebel
gedankennebel / data_model.ftl
Last active May 11, 2016 14:11
Render the current data model keys that are used in a freemarker template
<ul>
<#list .data_model?keys as key>
<li>${key}</li>
</#list>
</ul>
@gedankennebel
gedankennebel / no-border.css
Created November 20, 2015 12:36
Remove Bootstrap border
.btn, .navbar, .popover, input, textarea {
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
@gedankennebel
gedankennebel / gist:a4c9367cda02ad7e826f
Created November 4, 2015 17:47 — forked from bergantine/gist:5243223
CSS grayscale filter (go from grayscale to full color on hover) #css #sethneilson
img:hover {
-webkit-filter: grayscale(0%);
-webkit-transition: .5s ease-in-out;
-moz-filter: grayscale(0%);
-moz-transition: .5s ease-in-out;
-o-filter: grayscale(0%);
-o-transition: .5s ease-in-out;
filter: grayscale(0%);
}
@gedankennebel
gedankennebel / deleteLocalbranches.sh
Last active August 29, 2015 14:24
Remove all your local git branches but keep master
git branch | grep -v "master" | xargs git branch -D
@gedankennebel
gedankennebel / CachingItemRecommender
Created May 3, 2014 23:44
Act like a Mahout CachingRecommender + contains ItemBased-Features like recommenedBecause or mostSimilarItem
import com.google.common.base.Preconditions;
import org.apache.mahout.cf.taste.common.Refreshable;
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.impl.common.Cache;
import org.apache.mahout.cf.taste.impl.common.RefreshHelper;
import org.apache.mahout.cf.taste.impl.common.Retriever;
import org.apache.mahout.cf.taste.impl.model.PlusAnonymousUserDataModel;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.recommender.IDRescorer;
import org.apache.mahout.cf.taste.recommender.ItemBasedRecommender;
@gedankennebel
gedankennebel / jvm param
Created April 11, 2014 09:13
jvm parameter config recommended for use with apache mahout -> Xmx should be min. 1gb
-server
-Xmx2048m
-XX:+UseParallelGC
-XX:+UseParallelOldGC
-da
-dsa
-XX:NewRatio=9
-XX:-DisableExplicitGC
@gedankennebel
gedankennebel / Static method to get a duplicate free implementation of List
Created December 9, 2013 16:46
Static method to get a duplicate free implementation of List
public static <T> List<T> getDuplicateFreeList(List<T> list) {
List<T> duplicateFreeList = new ArrayList<>();
if (list != null) {
for (T listEntry : list) {
if (!duplicateFreeList.contains(listEntry)) {
duplicateFreeList.add(listEntry);
}
}
}
return duplicateFreeList;
@gedankennebel
gedankennebel / gist:7869922
Created December 9, 2013 09:59
Load data from a CSV fiel to MySQL
LOAD DATA LOCAL INFILE '/path/to/my/csv/file.csv'
INTO TABLE test.myTable
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
@gedankennebel
gedankennebel / intro.csv
Created November 29, 2013 13:35
intro.csv from Mahout in Action Listing 2.1
1 101 5.0
1 102 3.0
1 103 2.5
2 101 2.0
2 102 2.5
2 103 5.0
2 104 2.0
3 101 2.5
@gedankennebel
gedankennebel / gist:6605932
Last active December 23, 2015 08:09
Convert an image from file to byte[]
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
/**
* User: najum
* Date: 01.08.12
* Time: 12:51
*/
public class ImageToByteArray {