Skip to content

Instantly share code, notes, and snippets.

View arosenkranz's full-sized avatar

Alex Rosenkranz arosenkranz

View GitHub Profile
@arosenkranz
arosenkranz / json-to-csv.sh
Created November 20, 2023 16:21
Convert JSON to CSV
cat <file.json> | jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' > <output.csv>
@arosenkranz
arosenkranz / index.html
Created March 1, 2022 14:36
CSS Lightbox
<a href="#unique-id-of-image">
<img alt="alt text" src="../assets/filename.png" />
</a>
<a href="#" class="lightbox" id="unique-id-value">
<img alt="alt text" src="../assets/filename.png" />
</a>
@arosenkranz
arosenkranz / dateFormat.js
Created February 12, 2021 12:40
Date Formats
const addDateSuffix = (date) => {
let dateStr = date.toString();
// get last char of date string
const lastChar = dateStr.charAt(dateStr.length - 1);
if (lastChar === '1' && dateStr !== '11') {
dateStr = `${dateStr}st`;
} else if (lastChar === '2' && dateStr !== '12') {
dateStr = `${dateStr}nd`;
@arosenkranz
arosenkranz / hyper-sync
Created February 6, 2019 01:27
hyper sync
something

Grid Properties

Parent (Grid Container)


  grid-template-columns
  grid-template-rows: [optional: line name, in square brackets] <track-size> | <repeat>;
  	track-size: length, %, fr, auto
  	line name: an arbitrary name for this item. If no name assigned, a number is used
@arosenkranz
arosenkranz / FlexboxExplained.md
Created February 15, 2018 17:57
Flexbox Info

Flexbox Explained

For each of the directions below, add these declarations to the existing ul or li elements.

The first grouping has to do with the flex-container, or the ul in this example.

  1. ul { display: flex; } This gets everything on a single line. By default, the direction is in a row and in standard order.

  2. ul {display: flex; flex-direction: ***; }

@arosenkranz
arosenkranz / Git-Rules.md
Last active December 16, 2022 06:47
Git Cheatsheet

COMMIT RELATED CHANGES

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

COMMIT OFTEN

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having few large commits and sharing them rarely, in contrast, makes it hard to solve conflicts.

USE BRANCHES

Branching is one of Git‘s most powerful features - and this is not by accident: quick and easy branching was a central requirement from day one. Branches are the perfect tool to help you avoid mixing up different lines of

@arosenkranz
arosenkranz / Directories.md
Last active December 5, 2019 04:59
Command Line Cheat Sheet

pwd Display path of current directory.

cd <directoryName> Move into a directory. (no < > necessary)

cd .. Navigate up one directory (into a parent directory)

cd ../..