Skip to content

Instantly share code, notes, and snippets.

View kahboom's full-sized avatar
🍕
pizza

Rachel Yordán kahboom

🍕
pizza
View GitHub Profile
@simonrelet
simonrelet / asynchronous.js
Last active March 18, 2023 20:13
React hooks for asynchronous calls
import React from 'react'
/**
* @typedef {object} State The state of asynchronous hooks.
* @property {object | null} error The error.
* @property {boolean} pending Whether the call is pending.
* @property {any | null} result The result of the asynchronous call.
*/
/** @type {State} */
@hubgit
hubgit / SelectField.tsx
Last active December 29, 2023 03:41
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select
@cheungnj
cheungnj / script.sh
Last active March 6, 2024 02:35
Convert asciidoc to Github Flavored Markdown
# Adapted from https://tinyapps.org/blog/nix/201701240700_convert_asciidoc_to_markdown.html
# Using asciidoctor 1.5.6.1 and pandoc 2.0.0.1
# Install pandoc and asciidoctor
$ sudo apt install asciidoctor
$ sudo wget https://github.com/jgm/pandoc/releases/download/2.0.0.1/pandoc-2.0.0.1-1-amd64.deb
$ sudo dpkg -i pandoc-2.0.0.1-1-amd64.deb
# Convert asciidoc to docbook using asciidoctor
{
"apiEndpoint": "https://ipaas-staging.b6ff.rh-idev.openshiftapps.com/api/v1",
"title": "Syndesis",
"datamapper": {
"baseJavaServiceUrl": "https://ipaas-staging.b6ff.rh-idev.openshiftapps.com/v2/atlas/java/",
"baseMappingServiceUrl": "https://ipaas-staging.b6ff.rh-idev.openshiftapps.com/v2/atlas/"
},
"oauth": {
"clientId": "ipaas-ui",
"scopes": [],
@bleathem
bleathem / pf-webcomponent-native.md
Last active February 28, 2017 19:01
PatternFly Web Components / Framework-Native Proposal

PatternFly Web Components / Framework-Native Proposal

Where we stand

The PatternFly roadmap outlines a proposal to scale framework support by adopting a Web Component based solution for implementing pattern behaviours to support multiple web frameworks.

By building prototypes for PatternFly-webcomponents, we have shown that framework integration of web components is possible, but benefits from the introduction of framework-specific shims to provide application developers with a framework-native experience when consuming the web components.

The problem

Front-end developers are by-and-large in favor of the web component approach for implementing pattern behaviours. However, we need to achieve a critical mass of pattern implementations in order for developers to adopt the solution and begin contributing back their own implementations.

ipaas-edit-connector-options page 3:
{
"messages": [
],
"valid": true,
"canExecute": true,
"out": "",
"err": "",
getAll(): Observable<Connection[]> {
return this.forge.executeCommand({
commandId: 'ipaas-search-connectors',
data: {
inputList: [{ latest: true, filter: '' }]
}
})
.map((body) => {
return JSON.parse(body.message);
})
@msmfsd
msmfsd / es7-async-await.js
Last active February 4, 2024 17:38
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
brew update
brew upgrade
brew install --HEAD xhyve
# requires installing golang, 'brew install golang', set 'GOPATH' in your .bashrc to some directory like ~/go
go get github.com/docker/machine
cd $GOPATH/src/github.com/docker/machine
make build && make install
brew install docker-machine-driver-xhyve
@paulirish
paulirish / what-forces-layout.md
Last active May 23, 2024 14:12
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent