Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am paulorsbrito on github.
* I am paulobrito (https://keybase.io/paulobrito) on keybase.
* I have a public key ASAGNgzDqklvxmkkzTBRAevy_L2AJYz5aetk3IG_rPiyGwo
To claim this, I am signing this object:
@paulorsbrito
paulorsbrito / unfirebased.js
Last active November 19, 2018 12:45
Clone an object removing Firestore's stuffs from it
/**
* Clone an object removing Firestore's stuffs from it (ES7)
*
* @param {Object} obj - obj to work on
* @param {Array} ignoredProps - Additional props to ignore (always ignores "ref")
*/
export function unfirebased(obj, ignoredProps = []) {
ignoredProps = [...ignoredProps, 'ref']
@paulorsbrito
paulorsbrito / DjangoRestFrameworkClient.js
Created September 18, 2017 14:35
Rest client for admin-on-rest talk to django rest framework
import { stringify } from 'query-string';
import {
GET_LIST,
GET_ONE,
GET_MANY,
GET_MANY_REFERENCE,
CREATE,
UPDATE,
DELETE,
} from 'admin-on-rest';
@paulorsbrito
paulorsbrito / custom_highlighter.py
Last active December 25, 2015 07:28
This custom django-haystack highligther apply Whoosh's ChartsetFilter to both the keyword and the text, so a keyword 'café' gets highlighted on a text 'have a cup of cofe' and 'drink some café' as well. As you can see, it's strong coupled to whoosh backend.
# -*- coding: utf-8 -*-
from django.utils.html import strip_tags
from haystack.utils import Highlighter
from whoosh.analysis import CharsetFilter, RegexTokenizer
from whoosh.support.charset import accent_map
"""
This custom django-haystack highligther apply Whoosh's ChartsetFilter to both
the keyword and the text, so a keyword 'café' gets highlighted on a text
@paulorsbrito
paulorsbrito / search_backends.py
Last active December 25, 2015 07:28 — forked from gregplaysguitar/folding_whoosh_backend.py
This is a fork of Greg's gist, which allows use of character folding with haystack and whoosh. What I've done was to add allow EdgeNGram fields to be folded. This is useful if you're using autocomplete or just indexing text as EdgeNGram field to allow partial keywork search. Thanks, Greg. Have fun.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a fork of Greg's gist, which allows use of character folding with haystack and whoosh. What
I've done was to add allow EdgeNGram fields to be folded. This is useful if you're using autocomplete
or just indexing text as EdgeNGram field to allow partial keywork search. Thanks, Greg. Have fun.
-+- original comments -+
https://gist.github.com/gregplaysguitar/1727204