Skip to content

Instantly share code, notes, and snippets.

View seafoox's full-sized avatar

Alexandre Collin seafoox

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / HowTo_SublimeText2_Terminal_MacOSX
Created April 20, 2012 15:55
Launch SublimeText2 from the Terminal
## Launch SublimeText2 from the Terminal (on MacOS X) ##
1/ Open Terminal.app
2/ Copy/paste the following symbolic link. You can replace 'subl' at the end with the keyword of your choice
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
3/ Now you can open files and projects directly from the Terminal
- Open the current folder as a project: "subl ."
- Open a file "subl _PATH_/file.js"
@seafoox
seafoox / rAF.js
Created November 3, 2012 22:57 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
@seafoox
seafoox / SublimeLinter.sublime-settings
Created November 26, 2012 11:02
SublimeLinter Configuration
{
// If true, when the file is saved any errors will appear in a popup list
"sublimelinter_popup_errors_on_save": false,
// Javascript linter: "gjslint" to use the closure javascript linter (if available),
// or either "jshint" or "jslint" to use a built in linter.
"javascript_linter": "jshint",
// jshint: options for linting JavaScript. See http://www.jshint.com/options/ for more info.
@seafoox
seafoox / index.html
Created August 15, 2013 01:12
Defer loading of social script after onload --- URL: http://www.aaronpeters.nl/blog/why-loading-third-party-scripts-async-is-not-good-enough The loading of JS social buttons its deferred until onload event its fired.
<script>
(function(w, d, s) {
function go(){
var js, fjs = d.getElementsByTagName(s)[0], load = function(url, id) {
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.src = url; js.id = id;
fjs.parentNode.insertBefore(js, fjs);
};
load('//connect.facebook.net/en_US/all.js#appId=272697932759946&xfbml=1', 'fbjssdk');
load('https://apis.google.com/js/plusone.js', 'gplus1js');
@seafoox
seafoox / script.js
Last active December 21, 2015 03:59
Textfill Module // auto font resize based on the parent width
// Textfill Module
// ----------------
// auto font rezize based on the parent size
//
(function($, window) {
var initialFontSize = null;
$.fn.textfill = function(maxFontSize)
{
maxFontSize = parseInt(maxFontSize, 10);