Skip to content

Instantly share code, notes, and snippets.

View redox's full-sized avatar

Sylvain Utard redox

View GitHub Profile
redox / Listing.rb
Last active August 29, 2015 14:15 — forked from ArunGupta25/Listing.rb
class Listing < ActiveRecord::Base
include AlgoliaSearch
algoliasearch per_environment: true, if: :saleable do
attribute :title, :designer, :price, :description, :size, :category, :price_drops, :dropped, :price_updated_at, :created_at, :cover_photo, :images_processed, :bumped_at, :location, :strata, :retina_cover_photo, :retina_cover_height, :retina_cover_width, :followerno
attributesToIndex ['unordered(designer)', 'unordered(title)', 'unordered(description)', 'category', 'size', 'price']
customRanking ['desc(price_updated_at)']
ranking ['custom', 'desc(followerno)', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact']
synonyms [
redox / test.js
Last active August 29, 2015 13:58
How to redefine ttAdapter()
var index = client.initIndex('YourIndexName');
$('input#user_email').typeahead(null, {
// source is a function that takes the query and the typeahead.js callback function as parameters
source: function(query, cb) {
// perform the search, function(success, content) {
if (success) {
// at least one hit ?
if (content.hits.length > 0) {
firstHit = content.hits[0];
redox / base.html.haml
Last active May 16, 2020 13:13
Algolia extends HipChat to customer support
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-chevron-up').html_safe, ''
= link_to_function 'Chat with us', ''
.opened{style: 'display: none'}
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-plus-sign').html_safe, 'chat.maximize()', class: 'maximize', style: 'display: none'
redox / Algolia branding.html
Created March 6, 2014 17:01
Algolia branding code
"Built With:\n" +
"\n" +
" oooo oooo oo \n" +
" ooooo oooo ooooo ooooo \n" +
" ooooooo oooo oxxxxxxo ooooo oo \n" +
" ooooooooo oooo ooooo ooo oooooooo ooooo oooooo \n" +
" oooooooooo oooo ooooooooooooo oxxxooxxxxxxxxoo ooooo oooo ooooooooooo\n" +
" ooooo ooooo oooo oooooo oooo oxxxooo oooxxxoo ooooo oooo oooo\n" +
redox / eventbrite.html
Created March 4, 2014 18:42
Eventbrite demo
<form id="searchform" name="searchform" method="get" action="#" onsubmit="javascript:search()">
<input id="q" name="q" type="text" class="ui-autocomplete-input input-suggestion" maxlength="50" placeholder="Search for (e.g. music, networking)" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true" autocorrect="off" spellcheck="false">
<div style="float: left;">
<a class="eb_button medium go js-search-click-action" id="search_button" href="javascript:search()">Search</a>
<div style="float: left; margin-left: 20px; margin-top: 10px;">
<input type="checkbox" name="around_me" id="around_me" />
<label for="around_me">Around me</label>
<div style="clear: both; text-align: right; padding-top: 10px; margin-right: 290px;">
redox / ecommerce.html
Created March 4, 2014 16:58
E-commerce demo
<div class='input-group'>
<input autocomplete='off' autocorrect='off' class='form-control' id='searchinput' placeholder='Search a product, brand, category...' spellcheck='false' type='text'>
<span class='input-group-addon'>
<i class='icon-search'></i>
<div class='categories'></div>
<div class='brands'></div>
<div class='products'></div>
redox / leanstack.html
Created March 4, 2014 16:55
Leanstack demo
<input class='search-query search-query-small' id='searchbox' type='text'>
<div class="suggestions">
<div class="cats"></div>
<div class="stacks"></div>
<div class="services"></div>
<div class="powered-by-algolia"></div>
<script src="" type="text/javascript"></script>
<script type="text/javascript">
redox / .travis.yml
Last active January 2, 2016 05:09
Testing your Jasmine-based JS project with Travis-ci
language: node_js
- 0.8
# 'npm test' runs 'grunt test'
- npm install -g grunt-cli
# these are secured environment variables encoding ALGOLIA_APPLICATION_ID=****** and ALGOLIA_API_KEY=****************
- secure: ZCrJySSbsKxDV2ps8xDlUA0HwOxPVXj/AkzJHi0oa6MznF0mac9rEtOt0MF+POPewhIrL62vwTVMGWGyHYJ6RvpyW3SVRpHsKlzHhNnDJ6TMFCqVM5yPZ8JZzR8O2+XjQXOmZVZ4P+4ahnr9UCba8gzhj5WNoAUnyQEXXRCklwc=
redox / Gemfile
Last active December 29, 2015 11:29
Blazing fast search engine showing relevant results after the first keystroke in your Jekyll blog. Based on Algolia Search + Typeahead.js <3
gem 'jekyll'
gem 'github-pages'
gem 'algoliasearch'