Skip to content

Instantly share code, notes, and snippets.

View minmaxdata's full-sized avatar
🐕

Ke McAdams minmaxdata

🐕
  • DTN
  • Seattle, WA
View GitHub Profile
import React from 'react';
class MicroFrontend extends React.Component {
componentDidMount() {
const { name, host, document } = this.props;
const scriptId = `micro-frontend-script-${name}`;
if (document.getElementById(scriptId)) {
this.renderMicroFrontend();
return;
// frog
const sally = new FrogBuilder('sally', 'female')
.setEyes([{ volume: 1.1 }, { volume: 1.12 }])
.setScent('blueberry')
.setHeart({ rate: 12 })
.setWeight(5)
.setHeight(3.1)
.setLegs([
{ size: 'small' },
{ size: 'small' },
@hasschi
hasschi / findMedianSortedArrays.js
Last active December 3, 2019 23:20
LeetCode #4. Median of Two Sorted Arrays
/**
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number}
*/
var findMedianSortedArrays = function(A, B) {
//確保A > B
if(A.length < B.length){
let tmp = A;
A = B;

Welcome to SSP!

(Approximate onboarding time: 45 minutes -- see time breakdowns next to each video)

These videos will introduce you to some of the tools you need to successfully start and navigate through this course. The recordings are from a live demonstration during a previous round of SSP, and may refer to it by number, but do not worry! These instructions are still relevant to you and your current SSP. Please ignore any referenced to the SSP numbered 38. I'll say it again..

>> Please ignore any references to the SSP numbered 38 :-)

Now that we've got that out of the way, let's get into the videos.

@shawn-kb
shawn-kb / flatlist.js
Created August 3, 2018 19:54
call content from a function
render() {
if(stores.systemStore.preferToScroll == true){
return(
<View>
{this._renderRegisterDeviceModal}
<FlatList
data={stores.databaseStore.sites.slice()}
keyExtractor={ (item, index) => item.id}
key = {( stores.systemStore.preferToScroll ) ? 1 : 0}
numColumns={1}
class Example extends React.Component<
Props,
State,
Snapshot
> {
static getDerivedStateFromProps(
nextProps: Props,
prevState: State
): $Shape<State> | null {
// ...
@alexishida
alexishida / nginx-config-auth-cert-ssl.md
Last active May 24, 2024 08:09
Tutorial to configure Nginx client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Original: https://gist.github.com/mtigas/952344

Convert SSL certificate from CRT format to PEM

openssl x509 -in server.crt -out server.der -outform DER
openssl x509 -in server.der -inform DER -out server.pem -outform PEM
@iHani
iHani / Currying.js
Last active August 4, 2018 22:56
Currying (also partial application)
function person (name) {
return function age (age) {
return `${name} is ${age}`
}
}
// if we called
const arg1 = 'Richard'
const arg2 = 30
console.log(person(arg1)(arg2))
@bvaughn
bvaughn / updating-external-data-when-props-changes-using-promises.js
Last active June 16, 2024 21:56
Example for loading new external data in response to updated props
// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};
@iHani
iHani / async-await.js
Last active August 4, 2018 22:52
async await basic example.
const isLargerOrEqualTo100 = (a) => {
return new Promise((resolve, reject) => {
if (a >= 100) {
resolve(`${a} is >= 100`)
} else {
reject(`${a} is < 100`)
}
})
}