Skip to content

Instantly share code, notes, and snippets.

View chr33s's full-sized avatar

chris chr33s

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active December 10, 2025 13:22
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@bakura10
bakura10 / microdata-schema.liquid
Last active July 21, 2025 07:34
This is the last microdata-schema for our Shopify themes
{%- comment -%}
This snippet structures the micro-data using JSON-LD specification. Please note that for Product especially,
the schema often changes. We try to output as much info as possible, but Google may add new requirements over time,
or change the format of some info
LAST UPDATE: May 10th 2023 (we added the "hasMerchantReturnPolicy" and "shippingDetails" to include the shipping and
return policy if they have been specified as store policies).
{%- endcomment -%}
{%- if request.page_type == 'product' -%}
@EvanBacon
EvanBacon / A-look-at-Hooks.md
Created June 18, 2019 22:46
A look at some different approaches to using hooks for pseudo classes.

Many ways to useHooks

When I try to learn something, I search around for the optimal approach. In the case of hooks I found two reasonable approaches and one approach that only makes sense in some use-cases. Below I've documented all of them.

Use Case (useCase 😘)

I want to change the style of a text element when the user is clicking down on it. Because this is React Native for web, there are no CSS pseudo classes, so I need to manage all of the state myself. Because classes like active, focus, hover, and visited could be commonly used the API must be very self-contained. ... and I want people to like me, so I'm using hooks (the old implementation used render props).

Spread props

@DimitryDushkin
DimitryDushkin / configs.js
Created October 2, 2018 14:19
React Native 0.57 + Babel 7 + Typescript + Jest
// babel.config.js
module.exports = {
"presets": [
"module:metro-react-native-babel-preset",
],
"plugins": [
["module-resolver", {
"root": ["./src"],
"extensions": [".js", ".ts", ".tsx", ".ios.js", ".android.js"]
}],
@sergey-shpak
sergey-shpak / git-log-to-json.js
Last active October 23, 2019 18:55
Git log to json (git changelog nodejs)
const { exec } = require('child_process');
// Compile 'git log' command
const command = params =>
`git log --pretty=format:"
${params.join(command.format.param)}
${command.format.line}"`;
const hash = 451436388.16325235; //Math.random()*10e8;
command.format = {

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

@watson
watson / airplay.md
Last active November 5, 2024 23:27
An overview over my AirPlay related modules
@nwjlyons
nwjlyons / common.sh
Last active September 5, 2021 22:21
Instructions on how to wire up your MacBook Pro function keys to control your laptop hardware in Crunchbang
#! /bin/bash
case $1 in
up)
TOTAL=`expr $CURRENT + $INCREMENT`
if [ $TOTAL -gt $MAX ]; then
exit 1
fi
echo $TOTAL > $FILE
;;
@robbypelssers
robbypelssers / gist:9994915
Last active November 16, 2020 11:44
Javascript: Operators
//Try this code out at http://repl.it/languages/JavaScript
/**********************************************************************************************
Operators listed by precedence:
Operator Operation A N
--------------------------------------------------------------
++ Pre-or post increment R 1
-- Pre-or post decrement R 1
@ndarville
ndarville / business-models.md
Last active October 9, 2025 17:55
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google