Skip to content

Instantly share code, notes, and snippets.

View minmaxdata's full-sized avatar
🐕

Ke McAdams minmaxdata

🐕
  • 18:20 (UTC -07:00)
View GitHub Profile
@iHani
iHani / Promises.js
Last active August 4, 2018 22:58
Promises in JavaScript with examples
/*
* ** Diffrence between Tasks and Promises:
* Once settled, a promise can not be resettled. Calling resolve() or reject() again will have no effect. The immutability of a settled promise is an important feature.
* https://medium.com/javascript-scene/master-the-javascript-interview-what-is-a-promise-27fc71e77261
* *** First arg is for 'resolved' status, and the second is for 'rejected'
*/
// exampe 1
const myPromise = function () {
return new Promise((Yay, Nay) => {
@iHani
iHani / Destructuring.js
Last active August 6, 2018 20:11
Destructuring in ES2015 basic examples
/*
* Object Destructuring
*/
const book = {
title: 'ReWork',
author: 'Some guy',
publisher: {
name: 'Penguin'
}
}
@iHani
iHani / hoc.js
Last active August 6, 2018 20:11
Higher Order Component (HOC) example with React
// Higher Order Component (HOC) : A component that renders another component
// Goal: Reduce code, render hijacking, prop manipulation, abstract state
// Inspired by mead.io videos on Udemy
import React from 'react'
import reactDOM from 'react-dom'
const info = (props) => (
<div>
<h1>Hello { props.isAdmin ? 'admin' : 'guest' }</h1>
@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`)
}
})
}
@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 / 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))
@alexishida
alexishida / nginx-config-auth-cert-ssl.md
Last active August 28, 2025 05:34
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
class Example extends React.Component<
Props,
State,
Snapshot
> {
static getDerivedStateFromProps(
nextProps: Props,
prevState: State
): $Shape<State> | null {
// ...
@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}

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.