Skip to content

Instantly share code, notes, and snippets.

// Adds a lovely fade in of the modal
// and a gentle slide-down of the modal content
class Demo extends React.Component {
state = { showDialog: false };
render() {
return (
<div>
<button onClick={() => this.setState({ showDialog: true })}>
Show Dialog
</button>
@mnguyenngo
mnguyenngo / zscore.py
Last active August 1, 2024 19:58
Code to calculate and plot the z-score
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as scs
def z_val(sig_level=0.05, two_tailed=True):
"""Returns the z value for a given significance level"""
z_dist = scs.norm()
if two_tailed:
sig_level = sig_level/2
area = 1 - sig_level
const puppeteer = require("puppeteer");
let waitTime = 5 * 1000;
async function testAjax() {
const url = "https://www.notion.so/Test-page-all-c969c9455d7c4dd79c7f860f3ace6429"
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setRequestInterception(true);
// those we don't want to log because they are not important
const Brakes = require('brakes');
const Async = require('crocks/Async');
const fetch = require('node-fetch');
const assoc = require('crocks/helpers/assoc');
const compose = require('crocks/helpers/compose');
const composeK = require('crocks/helpers/composeK');
const defaultTo = require('crocks/helpers/defaultTo');
const propOr = require('crocks/helpers/propOr');
const and = require('crocks/logic/and');
@evilsoft
evilsoft / bigTest.txt
Created June 2, 2018 22:29
Fun for Selwyn
Hello. how are you?
Hello. how are you?
Hello. how are you?
Hello. how are you?
Hello. how are you?
@swalkinshaw
swalkinshaw / tutorial.md
Last active January 5, 2026 14:33
Designing a GraphQL API
import { contains, propEq, filter, flip, propSatisfies, isEmpty, compose, head, not } from 'ramda'
import { isFunction, isArray } from 'crocks'
// Query = Function | Array
// Set = [a]
// defineSet :: Query -> a -> Set
export const defineSet = q => x =>
(isFunction(q) && q(x)) || (isArray(q) && contains(x)(q)) ? [ x ] : []

Frontend Masters—Deploying Full Stack: Node.js & React on AWS

You should have the following completed on your computer before the workshop:

  • Have Node.js installed on your system. (Recommended: Use nvm.)
    • Unfortunately, you'll need to be on Node 9.x or earlier. Dependencies are hard and one of the dependencies of one of our dependencies is set to not allow Node 10.x.
    • Install yarn with brew install yarn.
  • Create an AWS account. (This will require a valid credit card.)
  • Install multi-factor authentication app (e.g. Authy, Google Authenticator, Duo).
  • Install the AWS CLI. (brew install awscli should do the trick. Otherwise, you'll need Python and PIP, which you can install using brew install python.)
@elijahmanor
elijahmanor / README.md
Last active November 21, 2024 16:43
Export @code Extensions to a Markdown List

You can run either of the following snippets in your terminal to generate a markdown list of your VS Code extensions.

code --list-extensions | awk '{ print "* [" $1 "](https://marketplace.visualstudio.com/items\?itemName\=" $1 ")" }'

npx https://gist.github.com/elijahmanor/7f9762a4c2296839ad33e33513e88043

NOTE: You can append | pbcopy to either of the above commands to pipe the output to your Mac's copy/paste buffer.

@getify
getify / 1.md
Last active October 15, 2020 01:44
BetterPromise: a strawman experiment in subclassing Promise and "fixing" a bunch of its awkward/bad parts

Some things that are "better" with this BetterPromise implementation:

  • BetterPromise # then(..) accepts a BetterPromise (or Promise) instance passed directly, instead of requiring a function to return it, so that the promise is linked into the chain.

    var p = BetterPromise.resolve(42);
    
    var q = Promise.resolve(10);
    
    p.then(console.log).then(q).then(console.log);