Skip to content

Instantly share code, notes, and snippets.

@JM-Mendez
JM-Mendez / App.js
Created June 30, 2020 13:09 — forked from aislanmaia/App.js
Example for how to enable hot-reload with xstate and use-machine libraries and an example project.
import React, { useContext } from "react";
import Dashboard from "./Dashboard";
import Login from "./Login";
import AppContext from "./AppContext";
export default () => {
const { machine, error } = useContext(AppContext);
console.log("executing App component...");
return (

Using JSDOC-Based TypeScript

Get Started

Choose your editor

  • WebStorm, Rider
    • Partial support, not enough intelli hints
    • Toggle on TypeScript language service
  • VSCode
@JM-Mendez
JM-Mendez / antialias.css
Created June 7, 2020 22:46
Fix light font on dark text if it looks bold
antialias {
-moz-osx-font-smoothing: grayscale,
-webkit-font-smoothing: antialiased,
}
@JM-Mendez
JM-Mendez / visuallyHidden.css
Created June 7, 2020 22:06
Accessibly hide text elements (mainly useful for section headers)
/* https://a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
white-space: nowrap; /* added line */
@JM-Mendez
JM-Mendez / machine.js
Last active May 26, 2020 14:42
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@JM-Mendez
JM-Mendez / print_background_colors.css
Created May 26, 2020 11:55
#CSS snippet to enable printing background colors and images to pdf in chrome
html body {
-webkit-print-color-adjust: exact;
}
@JM-Mendez
JM-Mendez / responsive-video.css
Created September 2, 2019 01:21 — forked from jaicab/responsive-video.css
Pure CSS solution for embed videos with an aspect ratio of 16:9
.video-container {
position: relative;
padding-bottom: 56.25%; /*16:9*/
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
@JM-Mendez
JM-Mendez / fresh-chrome.sh
Created August 26, 2019 16:24 — forked from stuartsierra/fresh-chrome.sh
Launch new instances of Google Chrome on OS X with isolated cache, cookies, and user config
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@JM-Mendez
JM-Mendez / selection-command.js
Created May 28, 2019 00:31 — forked from erquhart/selection-command.js
Text selection commands for Cypress.io
/**
* Credits
* @Bkucera: https://github.com/cypress-io/cypress/issues/2839#issuecomment-447012818
* @Phrogz: https://stackoverflow.com/a/10730777/1556245
*
* Usage
* ```
* // Types "foo" and then selects "fo"
* cy.get('input')
* .type('foo')
@JM-Mendez
JM-Mendez / reader.js
Created December 13, 2018 01:20 — forked from dypsilon/reader.js
Example usage of the reader monad.
/**
* This short program will encrypt the user password
* and insert a new record into a mock database.
*/
const Reader = require('fantasy-readers');
const R = require('ramda');
const crypto = require('crypto');
// our mock database
const database = [