Skip to content

Instantly share code, notes, and snippets.

🗣
on hackernews...I mean, err coding

Bram Adams bramses

🗣
on hackernews...I mean, err coding
Block or report user

Report or block bramses

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bramses
bramses / algolia-plugin.js
Created May 31, 2019
Algolia Plugin -- Gatsby
View algolia-plugin.js
{
resolve: `gatsby-plugin-algolia`,
options: {
appId: process.env.APP_ID,
apiKey: process.env.API_KEY,
indexName: 'star-wars-characters', // for all queries
queries,
chunkSize: 10000, // default: 1000
}
}
@bramses
bramses / Menu.js
Created May 30, 2019
Algolia Custom Component
View Menu.js
import React from "react"
const Menu = ({ items, refine, title }) => (
<div>
<p className="star-wars-facet">{title}</p>
<hr className="star-wars-hr"/>
<ul>
{items.map(item => (
<li style={{ listStyle: 'none' }} key={item.value}>
<a href="#" style={{ fontWeight: item.isRefined ? 'bold' : '', textDecoration: 'none' }} className="star-wars-facet" onClick={event => {
@bramses
bramses / two_functions.py
Created Jul 6, 2018
How To test Without Really Trying
View two_functions.py
def hard_state_add_5(whole_obj):
if "a" in whole_obj:
return whole_obj["a"] + 5
def easy_state_add_5(input_num):
return input_num + 5
def main():
whole_obj = {}
whole_obj["a"] = 10
@bramses
bramses / indexOf.java
Created Jul 6, 2018
Java Implementation of indexOf()
View indexOf.java
public int indexOf(int ch, int fromIndex) {
if (fromIndex < 0) {
fromIndex = 0;
} else if (fromIndex >= count) {
// Note: fromIndex might be near -1>>>1.
return -1;
}
if (ch < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
// handle most cases here (ch is a BMP code point or a
You can’t perform that action at this time.