Skip to content

Instantly share code, notes, and snippets.

View ricka's full-sized avatar

Rick Arnett ricka

View GitHub Profile
@abstractvector
abstractvector / Dockerfile
Last active April 25, 2023 13:57
Lightweight node.js Dockerfile
ARG ALPINE_VERSION=3.11
ARG NODE_VERSION=15.5.1
##########################
# Cache-preserving image #
##########################
FROM alpine:${ALPINE_VERSION} AS deps
RUN apk --no-cache add jq
import map from 'lodash/map';
import Promise from 'bluebird';
function isNode({ key, type, linkType } = {}) {
return (key === 'sys' && type === 'Link' && (linkType === 'Entry' || linkType === 'Asset'));
}
// TODO: combine these somehow
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@manasthakur
manasthakur / grepping.md
Last active September 24, 2022 13:30
Vim: Creating your own ack.vim/ag.vim

Creating your own ag.vim

Vim provides built-in mechanisms to search through projects in the form of the grep command. However, on large projects, grep is known to be slow; and hence people have been switching to simpler searchers like ack, and faster, parallel (metal?) searchers like ag and pt. Correspondingly, several plugins have been created that integrate these tools in vim: ack.vim, ag.vim, etc.

However, it's actually very easy to get the functionalities these plugins provide (faster search, results in quickfix-window, jumps, previews, and so on) in vanilla Vim itself; in fact, Vim already populates the grep-search results in a quickfix window. We just need to tell Vim to do the following things (use-case: ag):

  • Use ag as the default grep program
  • Open quickfix window by default
  • Create mappin
@tushar-borole
tushar-borole / traverse.js
Last active May 16, 2023 17:37 — forked from steinfletcher/traverse.js
Object tree traversal in javascript (with lodash)
var data = {
"name": "root",
"contents": [
{
"name": "A",
"contents": [
{
"name": "fileA1",
"contents": []
}
@dannguyen
dannguyen / wget-snapshotpage.md
Last active December 25, 2023 20:57
Use wget to snapshot a page and its necessary visual dependencies

Use wget to mirror a single page and its visible dependencies (images, styles)

Money graphic via State of Florida CFO Vendor Payment Search

Graphic via State of Florida CFO Vendor Payment Search (flair.myfloridacfo.com)

This is a quick command I use to snapshot webpages that have a fun image I want to keep for my own collection of WTFViz. Why not just right-click and save the image? Oftentimes, the webpage in which the image is embedded contains necessary context, such as captions and links to important documentation just incase you forget what exactly that fun graphic was trying to explain.

@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git