Skip to content

Instantly share code, notes, and snippets.

View seafoox's full-sized avatar

Alexandre Collin seafoox

View GitHub Profile
@seafoox
seafoox / script.js
Created June 25, 2015 14:23
Remove StopWords
var stopwordsList = ['l','le','la','les','du','de','des','a','du','en','au','aux','dont','par','pour','vos','es','est','sois','soit','sommes','sont','soyez','soyons','suis','étions','eté','êtes','ai','aie','aient','aies','ait','as','aura','aurai','auraient','aurais','aurait','auras','aurez','auriez','aurions','aurons','auront','avaient','avais','avait','avez','aviez','avions','avoirs','avons','ayant','ayez','ayons','eu','eue','eues','eurent','eus','ont'];
function removeStopWords(string) {
var queryWords = string.split(' ');
var finalString = [];
for (var i=0; i<queryWords.length-1; ++i) {
if (stopwordsList.indexOf(queryWords[i]) !== -1)
continue;
finalString.push(queryWords[i]);
@seafoox
seafoox / pom.xml
Created November 3, 2014 21:20
Algolia pom.xml
<dependency>
<groupId>com.algolia</groupId>
<artifactId>algoliasearch</artifactId>
<version>[1.2.3,]</version>
</dependency>
<repository>
<id>algoliasearch</id>
<name>Algolia Search Client</name>
<url>https://raw.githubusercontent.com/algolia/algoliasearch-client-java/master/repository</url>
</repository>
@seafoox
seafoox / demo.html
Created September 1, 2014 10:08
algolia-rapgenius-demo
<input class="quick_search autocomplete search ac_input example" data-url="/search/quick" id="q" name="q" placeholder="Search: rapper, song title, or lyrics" type="text" autocomplete="off">
<div class="suggestions" style="display: none">
<div class="suggestions-rappers"></div>
<div class="suggestions-songs"></div>
<div class="suggestions-lyrics"></div>
</div>
<script src="https://d3ibatyzauff7b.cloudfront.net/assets/algolia/algoliasearch.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var algolia = new AlgoliaSearch('EBTM1YDM40', '1113dae74afc7b12f3d06259d7154d95');
@seafoox
seafoox / algolia-demo.js
Created August 22, 2014 10:20
Algolia - Demo
<script type="text/javascript">
var apiClient = new AlgoliaSearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');
var idx = apiClient.initIndex('tvshows');
function displayShowCallback(success, content) {
html = '';
for (var i = 0; i < content.hits.length; ++i) {
html += '<tr>' +
' <td class="text-center"><img src="' + content.hits[i].image + '></td>' +
' <td class="text-left">' + content.hits[i].show_name + '</td>' +
@seafoox
seafoox / algolia-vestairecollective-demo.js
Last active October 24, 2016 18:59
Algolia - VestaireCollective demo
<script type="text/javascript">
var last_query = '';
var client = new AlgoliaSearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');
function searchCallback(success, content) {
$('.browser-page-help').hide();
if (content.results.length < 2 || content.results[0].query != last_query) {
return;
}
@seafoox
seafoox / gist:4348d37828208c86713d
Created July 28, 2014 08:52
Disable Chrome's two-finger back/forward navigation
# Open terminal and type
defaults write com.google.Chrome.plist AppleEnableSwipeNavigateWithScrolls -bool FALSE
# For mavericks
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE
@seafoox
seafoox / touch-detect.js
Created September 2, 2013 01:05
Detecting the ‘Tap’ event on a Mobile touch device using javascript --- JSFiddle: http://jsfiddle.net/gianlucaguarini/56Szw/light/
var $touchArea = $('#touchArea'),
touchStarted = false, // detect if a touch event is sarted
currX = 0,
currY = 0,
cachedX = 0,
cachedY = 0;
//setting the events listeners
$touchArea.on('touchstart mousedown',function (e){
e.preventDefault();
/*
A (very) WIP collection of optimized/recommended jQuery plugin patterns
from @addyosmani, @cowboy, @ajpiano and others.
Disclaimer:
-----------------------
Whilst the end-goal of this gist is to provide a list of recommended patterns, this
is still very much a work-in-progress. I am not advocating the use of anything here
until we've had sufficient time to tweak and weed out what the most useful patterns
// Skeleton jQuery plugin
function($)
{
$.fn.myPlugin = function( options )
{
// options.
$.fn.myPlugin.settings = $.extend( {}, $.fn.myPlugin.defaults, options );
// Go through the matched elements and return the jQuery object.
@seafoox
seafoox / history-log
Created August 27, 2013 04:59
Javascript log function with history
window.log = function () {
log.history = log.history || [];
log.history.push(new Date(), arguments);
if (this.console) {
arguments.callee = arguments.callee.caller;
var a = [].slice.call(arguments);
(typeof console.log === "object" ? log.apply.call(console.log, console, a) : console.log.apply(console, a))
}
log.displayHistory = function() {
for (var i=0, len=window.log.history.length; i<len; i++)