Skip to content

Instantly share code, notes, and snippets.

View plusjade's full-sized avatar
🐵
🚀 🤖

Jade Dominguez plusjade

🐵
🚀 🤖
View GitHub Profile

We create an index with:

  • two filters: synonyms_expand and synonyms_contract
  • two analyzers: synonyms_expand and synonyms_contract
  • three text fields:
    • text_1 uses the synonyms_expand analyzer at index and search time
    • text_2 uses the synonyms_expand analyzer at index time, but the standard analyzer at search time
    • text_3 uses the synonyms_contract analyzer at index and search time

.

@plusjade
plusjade / pages_filter.rb
Created November 30, 2013 11:12
Ruhoh plugin to pragmatically filter pages in a pages collection by an arbitrary prefix. Useful for filtering into sub-directories of the pages collection.
# ./my-blog/plugins/pages_filter.rb
module PagesFilter
# Filter pages by custom prefix.
# The prefix string is compared against the id which is the relative filepath.
# This enables sub-directory filtering.
# Example:
# <ul>
# {{# docs.filter.2/widgets/ }}
# <li>{{ title }}</li>
<div style="background-color:#333">Hello!</div>
@plusjade
plusjade / github.rb
Created September 23, 2013 06:41
GitHub Pages publishing strategy for ruhoh v2.5
require 'tmpdir'
# Usage:
# add to ruhoh-site/plugins/publish/github.rb
# - Your GitHub remote must be setup properly but The command will try to walk you through it.
# - You must have a clean working directory to publish to GitHub pages since the hook is actually triggered by commits.
#
# $ cd ruhoh-site
# $ bundle exec ruhoh publish github
class Ruhoh
@plusjade
plusjade / pages_random.rb
Last active December 23, 2015 08:09
Ruhoh plugin to pragmatically get a list of n random pages from an arbitrary pages collection.
# ./my-blog/plugins/pages_random.rb
module PagesRandom
# Return n random page objects.
# Limit can be set in config.yml:
# pages:
# random_limit: 10
def random
limit = config['random_limit'].to_i
limit = limit > 0 ? limit : 5
@plusjade
plusjade / folder_tree.rb
Last active December 23, 2015 07:59
Mustache block helper to quickly build folder tree heirarchies in HTML. The output uses nested unordered HTML lists. Example: http://ruhoh.com/docs/2/javascripts/ Usage: Place this in "./my-site/plugins/folder_tree.rb" then reload your web-server session. See inline documentation for syntax.
module FolderTree
# Mustache block helper to quickly build folder tree heirarchies in HTML.
# The output uses nested unordered HTML lists.
#
# Usage:
# {{# folder_tree }}
# pages
# about.md
# posts
# essays
{
"login": "plusjade",
"data": {
"version": "2",
"market-value": {
"score": 3.04,
"confidence": 0.6,
"explain": [
{
"name": "CompaniesRank",
@plusjade
plusjade / config.yml
Created September 8, 2013 18:54
Sample http://ruhoh.com configuration file.
---
# Usage: http://ruhoh.com
# This helps parsers (and hosting platforms) determine which version is needed to compile your site.
# If you compile your blog yourself, setting this won't matter, but it's a nice thing to keep updated.
RuhohSpec: "2.1"
# Used for things like RSS that need the full URL to a given resource.
# This DOES NOT affect any of your paths or links in any way.
# This DOES NOT configure domain mapping. See post2.ruhoh.com for hosting options.
// model View
Gild.Views.ProfileTag = Backbone.View.extend({
model: Gild.Models.Tag,
tagName: "li",
initialize: function(attrs) {
this.model.bind("change", this.render, this);
this.model.bind("destroy", this.remove, this);
},
@plusjade
plusjade / international-support.json
Last active December 21, 2015 18:29
Elasticsearch-ing How I make sense of what the hell is going on in ES. Essentially a "control test" environment. Validate the minimum possible use-case, then iterate by one factor. Note I don't have any comments in there because you can copy and paste the entire top half into console and it will run in sequence.
curl -XDELETE 'http://localhost:9200/p'
curl -XPOST 'http://localhost:9200/p' -d '
{
"index" : {
"analysis" : {
"analyzer" : {
"default_index" : {
"tokenizer" : "standard",
"filter" : ["lowercase", "asciifolding", "mynGram"],