Skip to content

Instantly share code, notes, and snippets.

View MichaelAstreiko's full-sized avatar

Michael MichaelAstreiko

  • Belarus, Minsk
View GitHub Profile
@MichaelAstreiko
MichaelAstreiko / file1.groovy
Created September 6, 2012 14:25
Find Algorithm for similarities
/**
* Made test of three word comparison algorithms:
* JaroWinkler, SmithWatermanGotoh and Soundex
*
* Based on test result Soundex is chosen to be used in venue title merging algorithm
* It is more usable, so that I can say if similarity > 0.98 then is same word
*/
void testMergeAlgorithms() {
def cafeName1 = "Antonio Cafe"
def cafeName2 = "Antonio's Cafe"
@MichaelAstreiko
MichaelAstreiko / file1.groovy
Created September 6, 2012 14:32
Find similar words
import uk.ac.shef.wit.simmetrics.similaritymetrics.Soundex
boolean isSamePlace = false
Soundex soundexAlgorithm = new Soundex()
if(distanceBetweenVenues(place1, place2) < 200 && soundexAlgorithm.getSimilarity(placeName1, placeName2) > 0.98) {
isSamePlace = true
}
@MichaelAstreiko
MichaelAstreiko / DojoCheckCheckboxes
Created September 21, 2012 17:10
Check all checkboxes with name like ...
dojo.forEach(dojo.query('[id*=del-campaign]'), function(single) {
dojo.attr(single, "checked", true);
});
import static groovyx.net.http.Method.GET
import static groovyx.net.http.Method.POST
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.ContentType
import org.apache.commons.lang.BooleanUtils
import org.apache.commons.httpclient.methods.multipart.Part
import org.apache.commons.httpclient.methods.multipart.StringPart
import com.nearme.portal.http.MultipartEntityWrapper
import grails.converters.JSON
import com.nearme.portal.domain.authentication.User