Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jeremy Wagner malchata

🏠
Working from home
View GitHub Profile
@malchata
malchata / example-component.php
Last active Oct 5, 2020
Stateless component in PHP
View example-component.php
<?php
function SubscribeButton ($subscribed, $currentUserId, $userId, $className = null) {
if (!isset($userId) || !ctype_digit($userId) || $userId === $currentUserId) {
return "";
}
$subscribeButtonClasses = "subscribe-button";
if (!is_null($className)) {
View cookie-clicker-cheat.js
View react-menu-component.js
// Vendors
import React, { Fragment, Component } from "react";
// Components
import MenuItem from "../MenuItem/MenuItem.js";
// CSS
import "./Menu.css";
class Menu extends Component {
View addeventlistener-menu.js
console.time("Evaluate script.");
const menuToggleButton = document.getElementById("menu-toggle");
const closeMenuButton = document.getElementById("close-menu");
const menu = document.getElementById("menu");
const overlay = document.getElementById("menu-overlay");
let menuVisible = false;
const openMenu = function () {
console.time("Menu open.");
View preact-menu-component.js
// Vendors
import { h, render, Fragment, Component } from "preact";
// Components
import MenuItem from "../MenuItem/MenuItem.js";
// CSS
import "./Menu.css";
class Menu extends Component {
@malchata
malchata / styles.less
Created Apr 7, 2019
Just transferring over my atom styles to another machine the hard way.
View styles.less
atom-workspace {
--editor-font-size: 1.625rem;
}
atom-text-editor {
.cursor {
border-left: .25rem solid;
transition: opacity .1875s ease-out;
}
@malchata
malchata / create-react-app-prod-deps.txt
Last active Oct 14, 2020
List of production dependencies for a create-react-app application.
View create-react-app-prod-deps.txt
Below is the output of `npm ls --prod` for app boilerplate generated by create-react-app
For those concerned how many packages are deduped, the count is 1709, according to `grep` output piped to `wc`. This means 1,974 dependencies in this tree are not duplicates.
sample@0.1.0 /private/var/www/sample
├─┬ react@16.8.4
│ ├─┬ loose-envify@1.4.0
│ │ └── js-tokens@4.0.0
│ ├── object-assign@4.1.1
│ ├─┬ prop-types@15.7.2
View atom less
atom-workspace {
--editor-font-size: 1.625rem;
}
atom-text-editor {
.cursor {
border-left: .25rem solid;
transition: opacity .1875s ease-out;
}
View Median, Average, and p90th Image Request Size from HTTP Archive
/**
* Obtained from the HTTP Archive's BigQuery dataset.
* Dataset table name: httparchive.summary_requests.2018_04_15_desktop
* BigQuery guide: https://bit.ly/2wpdyOV
**/
{
"type": "image",
"format": "jpg",
"Requests": "9153030",
You can’t perform that action at this time.