Skip to content

Instantly share code, notes, and snippets.

View mmirus's full-sized avatar

Matt Mirus mmirus

  • Front Royal, VA, USA
View GitHub Profile
@CKolkey
CKolkey / Gemfile.dev
Last active March 14, 2024 15:44
Using personal gems with Bundle without bothering your colleagues.
# NOTE: When updating gems, the ENV var below will need to be _unset_, so bundler updates the correct lock file.
# NOTE 2: The name 'Gemfile.dev' isn't important - it could be `dev_gems.rb` or anything else.
# SETUP:
# - Set the ENV var: BUNDLE_GEMFILE=Gemfile.dev in your app dir
# - Add Gemfile.dev and Gemfile.dev.lock to your .gitignore (global or local)
# - Copy the rest of this gist into Gemfile.dev (in your project root):
# Copy real lock file to ensure it gets priority
@graelo
graelo / README.md
Last active September 9, 2024 11:06
Nvim 0.8 tree-sitter Python conceal

This highlights file should live in <nvim-conf>/after/queries/python/highlights.scm.

Please note that with neovim 0.8, for files which queries extend existing queries, you need to add ; extends at the top of the file (see [this discussion]).

Here is some Python file:

"""Test conceal."""
@sindresorhus
sindresorhus / esm-package.md
Last active November 15, 2024 15:20
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.
@Log1x
Log1x / windows.md
Last active March 13, 2022 13:33
Some stuff I use on Windows

Windows Setup

Screenshot

This contains various software and tools I use for customizing Windows.

Warning: Installing a bad Windows theme can render your system unusable (dwm.exe crash-loop – "black screen of death") due to resource map changes.

  • Always match your winver.exe build to the theme you're installing.
  • Before major build updates, always change back to a default windows theme.
@castwide
castwide / rails.rb
Last active October 24, 2024 16:26
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@bikubi
bikubi / README.md
Created March 1, 2019 12:39
Simple Purgecss setup for Roots Sage WordPress starter theme

Why

  1. Sage doesn't come with Purgecss (or uncss, etc.)
  2. Say, we use Bulma -- suddenly dist/main.css grows by 400K!
  3. Let's purge it!
  4. Oh dang, we need to whitelist /\.wp-/, /\.post-type/, /myfancylightbox/...
  5. Wait we are whitelisting pretty much everything from /resource/assets/styles!
  6. Isn't there an option to purge /node_modules/**/* only?
  7. Nope.
  8. purgecss start ignore, strategically placed, to the rescue!
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active October 24, 2024 18:10
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@austinpray
austinpray / bad.jsx
Last active September 19, 2018 19:43
PostListing Refactor. I'm using .jsx filenames so I can get proper filenames in the gist use .js or typescript in your project
import React from 'react'
const PostListing = ({post}) => (
<article>
<h3>{post.frontmatter.title}</h3>
<span>{post.frontmatter.date}</span>
<p>{post.excerpt}</p>
</article>
)
#!/bin/bash
# Regolith aka Un-Bedrock
# "But what if we need to hand it off to another agency?" No more!
# This script converts a Bedrock site to a normal WordPress structure.
# Run it from the root of a Bedrock project.
# Created by Nathan Knowler and Daniel Roe
echo "Converting Bedrock to a normal WordPress file structure..."
@mtx-z
mtx-z / wp-bootstrap4.4-pagination.php
Last active April 4, 2023 12:55
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support) (UPDATED for Bootstrap 5: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507
*