Skip to content

Instantly share code, notes, and snippets.

View thomasfr's full-sized avatar

Thomas Fritz thomasfr

View GitHub Profile

A case of nested subcategories

In many multilingual systems, there are nested hierarchis of categories, connected to different products that need to be searched by customers with different language preferences. Here is a possible approach, inspired by the Wordnet Project.

The setup

@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active March 12, 2025 01:22
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
BIN = ./node_modules/.bin
SRC = $(wildcard src/*.coffee)
LIB = $(SRC:src/%.coffee=lib/%.js)
build: $(LIB)
lib/%.js: src/%.coffee
@mkdir -p $(@D)
@$(BIN)/coffee -bcp $< > $@
@marcusgreenwood
marcusgreenwood / gist:4951476
Created February 14, 2013 09:08
Nginx 1s microcaching config for Hatch.js.
events {
worker_connections 1024;
}
http {
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
Compile the Redis "notifications" branch on Github.
Start Redis with ./redis-server --notify-keyspace-events yes
Subscribe to all the events with:
redis-cli psubscribe '*'
In another terminal window, play with redis-cli: set, del, expire, ... Only a few already work.
@defunctzombie
defunctzombie / browser.md
Last active July 15, 2024 04:13
browser field spec for package.json
@thomasfr
thomasfr / elasticsearch.conf
Created November 20, 2012 18:18 — forked from rbscott/elasticsearch.conf
upstart job for elastic search
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@thomasfr
thomasfr / rc.d
Created November 20, 2012 11:55 — forked from jippi/rc.d
Logstash Init script
update-rc.d logstash-shipper defaults
update-rc.d logstash-reader defaults
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@dmajda
dmajda / gist:2421891
Created April 19, 2012 15:49
Simple query language parser
{
function makeNode(type, head, tail) {
return tail.length > 0
? {
type: type,
terms: [head].concat(tail.map(function(t) { return t[1]; }))
}
: head;
}
}