Skip to content

Instantly share code, notes, and snippets.

@squarism
squarism / rethinkdb_elastic_spike.rb
Created May 13, 2013 03:54
RethinkDB json store, using nobrainer ORM, automatically update elasticsearch index on save callback. This is fantastic.
require 'tire'
require 'nobrainer'
NoBrainer.connect 'rethinkdb://server/company'
class Employee
include NoBrainer::Document
field :name
field :title
@karmi
karmi / test.doc
Last active March 25, 2017 09:57
Example of Elasticsearch's attachment handling
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@adamico
adamico / simple_form_bootstrap.rb
Created August 30, 2013 09:06
Twitter Bootstrap 3 initializer for Simple Form
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# you need an updated simple_form gem for this to work, I'm referring to the git repo in my Gemfile
config.input_class = "form-control"
config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.use :input
@tcjr
tcjr / messages.json
Last active December 25, 2015 06:59
Basic pagination with Ember
// The API accepts the page parameter and returns the pagination info in meta
{
"messages": [ ... ],
"meta": {
"pagination": {
"total_pages": 3,
"current_page": 1,
"total_count": 55
}
@stevehanson
stevehanson / es-attach.py
Last active February 13, 2017 11:39
Example using the elasticsearch-mapper-attachments (https://github.com/elasticsearch/elasticsearch-mapper-attachments) plugin to index files (pdf, docx, html, etc). Usage with "python es-attach.py my-filename. Credit to Lucas Vlcek's similar Gist using Perl - https://gist.github.com/lukas-vlcek/1075067.
import os
import sys
# constants, configure to match your environment
HOST = 'http://localhost:9200'
INDEX = 'test'
TYPE = 'attachment'
TMP_FILE_NAME = 'tmp.json'
@Aeon
Aeon / adapters-application.js
Last active March 21, 2016 18:50
faye adapter for ember-data
require('config/adapters/faye-adapter');
export default DS.FayeAdapter.extend();