Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / README.md
Last active April 19, 2025 09:46 — forked from btoone/curl.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@joyrexus
joyrexus / jq_vs_js.md
Last active April 12, 2025 09:10
Comparison of jQuery and vanilla JS for basic DOM manipulation.

jQuery vs native JS

Selecting Elements

var divs = $("div");

var divs = document.querySelectorAll("div");
@joyrexus
joyrexus / README.md
Last active March 22, 2025 12:57 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@joyrexus
joyrexus / README.md
Last active March 16, 2025 19:03
nested templates in go

Example of nested templates.

Given this file layout ...

.
├── server.go
└── templates
    ├── profiles.html
    └── layout.html
@joyrexus
joyrexus / README.md
Last active December 30, 2024 01:37
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@joyrexus
joyrexus / README.md
Last active December 13, 2024 00:46
Perl one-liners

Hi:

perl -e 'print "hello world!\n"'

A simple filter:

perl -ne 'print if /REGEX/'

Filter out blank lines (in place):

@joyrexus
joyrexus / README.md
Last active September 7, 2024 14:28
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

@joyrexus
joyrexus / README.md
Created March 28, 2014 16:59
Nested grouping of arrays

nest.js

A multi-level groupBy for arrays inspired by D3's nest operator.

Nesting allows elements in an array to be grouped into a hierarchical tree structure; think of it like the GROUP BY operator in SQL, except you can have multiple levels of grouping, and the resulting output is a tree rather than a flat table. The levels in the tree are specified by key functions.

See this fiddle for live demo.

@joyrexus
joyrexus / durham.md
Created October 24, 2017 00:59
durham favs
@joyrexus
joyrexus / README.md
Last active July 29, 2024 18:04
JavaScript array methods

JavaScript Array Methods

Excerpted from the D3 API docs.

Note esp. usage of the map, filter, and reduce iteration methods. For a nice intro to these methods, see Tom MacWright's talk Beyond the For Loop, and for quick guidance on when to use which iteration method, see this gist.

Mutation Methods

That modify the array: