Skip to content

Instantly share code, notes, and snippets.

View bignimbus's full-sized avatar
🙃

Jeff Auriemma bignimbus

🙃
View GitHub Profile
@bignimbus
bignimbus / redirect-to-docs.md
Last active September 15, 2023 18:18
github-boilerplates.md

Hi {{ name }}! Thanks for opening this Issue. I recommend reviewing this section of our docs: {{ title }}.

If nothing in the docs helps with what you're seeing, please consider posting in our Discord server or our Community Forum. The maintainers and other Apollo users are active on those platforms, they're great places to ask for help using Apollo {{ iOS/Client/Kotlin }}. In an effort to keep our Issues actionable, we're closing this Issue for now but please do feel free to re-open if there's a bug, documentation update, or feature idea that we should consider!

For more information about how to get the most out of the Apollo GraphQL Community, see this blog post 🚀

Keybase proof

I hereby claim:

  • I am bignimbus on github.
  • I am jeffauriemma (https://keybase.io/jeffauriemma) on keybase.
  • I have a public key ASCF2I-DD0nSd-2WFjybeqLVfE-bHCi9G6UlukU8Ibdq_Qo

To claim this, I am signing this object:

@bignimbus
bignimbus / Workflow.md
Last active January 30, 2019 17:37
Draft of HTML-CSS UI building workflow

Commit 1: enter all the content and order of how it will appear on the smallest supported screen. No structure, just literally only text and media nodes

Commit 2: enclose content in semantic tags. No layout considerations, just semantics. Headings get the appropriate <h#> tags, copy gets <p> tags, anchors get <a> tags, buttons get <button> tags, etc.

Commit 3: create an HTML layout out of block elements. <header>, <section>, <footer>, <nav>, <ul>, <ol>, etc. Sibling elements must have the same display value, otherwise nest them. E.g. a <span> can't be the sibling of a <div>. We still haven't written any CSS.

Commit 4: style all "inline" content, which encompasses elements with display: inline by default (e.g. text nodes, anchors, and spans). Styles should include resets, text colors, font sizes, line heights, font weights, etc. No margins, no padding, no heights, no widths (unless they are part of a CSS reset). No media queries, just get those inline elements styled for the s

const cropSvgToContentOnly = (svgElement) => {
const {
x,
y,
width,
height,
} = svgElement.getBBox();
const viewBoxValue = [x, y, width, height].join(' ');
svgElement.setAttribute('viewBox', viewBoxValue);
};
throw 'foo';
// throws an exception of type String and value "foo"
throw new Error('foo');
// throws an exception of type Error with message "foo"
foo();
// throws an exception of type ReferenceError (extends Error)
// with message "foo is not defined"
@bignimbus
bignimbus / example1.jsx
Last active March 3, 2018 03:34
React presentation source code examples
// From reactjs.org tutorial
class Square extends React.Component {
constructor(props) {
super(props);
this.state = { value: null };
}
render() {
return (
<button className="square" onClick={() => alert('click')}>
@bignimbus
bignimbus / example.spec.js
Created October 3, 2017 15:57
Async unit tests with Jest
const INTERVAL = 100;
function myFunction () {
setTimeout(() => {
console.log('hi');
}, INTERVAL);
}
describe('myFunction', () => {
it('should be testable', () => {
@bignimbus
bignimbus / svg-crop.js
Created July 14, 2017 22:04
Crop an SVG
// modified from https://stackoverflow.com/a/22650574
function cropSVG () {
var mySVG = document.querySelector('svg');
var bb = mySVG.getBBox();
var vb = [bb.x, bb.y, bb.width, bb.height];
mySVG.setAttribute("viewBox", vb.join(" "));
copy(mySVG.outerHTML);
}

Say you have a model that has_many of another model through a third, intermediary model.

class Foo
  has_many :bar_infos
  has_many :bars, through: :bar_infos

  accepts_nested_attributes_for :bar_infos
end
@bignimbus
bignimbus / fibonacci-generator.js
Last active September 16, 2016 19:18
Recursive sequential generator of Fibonacci numbers
function * fibonacci (one = 1, two = 1) {
let sum = one + two;
yield sum;
yield * fibonacci(two, sum);
}