Skip to content

Instantly share code, notes, and snippets.

View redox's full-sized avatar
👍
Focusing

Sylvain Utard redox

👍
Focusing
View GitHub Profile
@redox
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'
@redox
redox / .travis.yml
Last active January 2, 2016 05:09
Testing your Jasmine-based JS project with Travis-ci
language: node_js
node_js:
- 0.8
# 'npm test' runs 'grunt test'
before_script:
- npm install -g grunt-cli
# these are secured environment variables encoding ALGOLIA_APPLICATION_ID=****** and ALGOLIA_API_KEY=****************
env:
global:
- secure: ZCrJySSbsKxDV2ps8xDlUA0HwOxPVXj/AkzJHi0oa6MznF0mac9rEtOt0MF+POPewhIrL62vwTVMGWGyHYJ6RvpyW3SVRpHsKlzHhNnDJ6TMFCqVM5yPZ8JZzR8O2+XjQXOmZVZ4P+4ahnr9UCba8gzhj5WNoAUnyQEXXRCklwc=
@redox
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>
</div>
<script src="https://d3ibatyzauff7b.cloudfront.net/assets/algolia/algoliasearch.min.js" type="text/javascript"></script>
<script type="text/javascript">
@redox
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>
</span>
</div>
<div class='categories'></div>
<div class='brands'></div>
<div class='products'></div>
@redox
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>
<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>
<div style="clear: both; text-align: right; padding-top: 10px; margin-right: 290px;">
@redox
redox / Algolia branding.html
Created March 6, 2014 17:01
Algolia branding code
<script>
console.log(
"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
redox / base.html.haml
Last active May 16, 2020 13:13
Algolia extends HipChat to customer support
#chat-box.ubuntu.hidden-xs
.closed
.pull-right
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-chevron-up').html_safe, 'chat.show()'
.m-l-small
= link_to_function 'Chat with us', 'chat.show()'
.opened{style: 'display: none'}
.header
.pull-right
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-plus-sign').html_safe, 'chat.maximize()', class: 'maximize', style: 'display: none'
@redox
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
index.search(query, function(success, content) {
if (success) {
// at least one hit ?
if (content.hits.length > 0) {
firstHit = content.hits[0];
@redox
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 [