Skip to content

Instantly share code, notes, and snippets.

@olslash
olslash / gist:2f372184e78d0ddb48fe
Last active August 29, 2015 14:05
T9 blogpost - 6
Trie.prototype.getSuggestions = function(keyString, suggestionDepth) {
// Traverse the tree based on the key digits in keyString, to find the
// node where relevant words are stored.
var result = [];
var node = this;
for(var i = 0; i < keyString.length; i++) {
var thisKey = keyString[i];
if(!node.children.hasOwnProperty(thisKey)) { break; }
node = node.children[thisKey];
@olslash
olslash / gist:3b5fb7d3edf43ec0b9b2
Last active August 29, 2015 14:05
T9 blogpost - 7
function getDeeperSuggestions(root, maxDepth) {
// We traverse down every possible branch from the result node (the node
// corresponding to the keypad entry), saving words we see as we go and
// stopping when we reach the specified depth.sug
// deepSuggestions is an array with (maxDepth) subarrays.
// Each of the subarrays will be one depth level's suggestions.
var deepSuggestions = [];
while(deepSuggestions.length < maxDepth) {
deepSuggestions.push([]);

Keybase proof

I hereby claim:

  • I am olslash on github.
  • I am olslash (https://keybase.io/olslash) on keybase.
  • I have a public key whose fingerprint is 88CA 494E 18E4 88BF E1FD EC81 6E73 C114 5978 E765

To claim this, I am signing this object:

import React from 'react';
// import { } from 'lodash';
// import { PropTypes } from 'helpers/react';
// const { } = PropTypes;
const $NAME$ = ({
fields
} = {}) => (WrappedComponent) => {
class Wrapped$NAME$ extends React.Component {
import { createReducer } from 'helpers/redux';
// import { } from 'lodash';
export const namespace = '$NS$';
const ACTION = 'nc/$NS$/ACTION';
const defaultState = {
};
import React from 'react';
// import {} from 'lodash';
// import { PropTypes } from 'helpers/react';
// const {} = PropTypes;
export default class $NAME$ extends React.Component {
static propTypes = {};
static defaultProps = {};