Skip to content

Instantly share code, notes, and snippets.

@philiprenich
philiprenich / shortcuts.md
Last active August 29, 2015 14:21
Shortcuts I always forget

Screenshots

Clipboard

  • Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard
  • Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard
  • Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard

Desktop

  • Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop
  • Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop
@philiprenich
philiprenich / _flexbox.scss
Created October 14, 2015 01:23
Cross-browser compatible flexbox implementation
@mixin flex-container($dir: row nowrap, $align: stretch) {
$ios_orient: horizontal;
$ios_lines: multiple;
@if nth($dir, 1) == column {
$ios_orient: vertical;
}
@if length($dir) > 1 and nth($dir, 2) == nowrap {
$ios_lines: single;
}
@philiprenich
philiprenich / kobold-club-export.js
Last active July 8, 2019 22:28
Export bookmarklet to export kobold.club encounters
javascript: var defaultEmail=""; var email=window.prompt("Email to send data to:", defaultEmail);var lib=JSON.stringify(localStorage.getItem('5em-library')); var party=JSON.stringify(localStorage.getItem('5em-party-info')); var players=JSON.stringify(localStorage.getItem('5em-players')); var body = "http://kobold.club/\n\nlocalStorage.setItem('5em-library', "+lib+");localStorage.setItem('5em-party-info', "+party+");localStorage.setItem('5em-players', "+players+");"; var link=document.createElement('a');link.setAttribute('href',"mailto:"+email+"?subject=Kobold%20Club%20export&body="+encodeURIComponent(body));var body=document.querySelector("body");body.appendChild(link);link.click();
@philiprenich
philiprenich / remove-branches.sh
Last active February 12, 2024 23:58
Script to remove git branches without an upstream (removed or non-existant). Corresponding blog post: https://www.philiprenich.com/blog/delete-git-branches-with-no-remote-tracking-branch/
#!/bin/bash
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
echo "This script lists Git branches whose upstream tracking branches no longer exist (are \"[gone]\") and that have no upstream tracking branch."
echo "It will ask for confirmation to delete branches from each group."
echo "While the script can live anywhere, it will work on the current working directory's Git repository."
echo ""
exit 0
@philiprenich
philiprenich / bash-colors.sh
Last active June 8, 2022 05:09
Simple bash prompt with colors
# Outputs:
# [Jun 08 13:45] user:/cwd $
# Date is dimmed white, user is bold green, colon is white, cwd is bold green, prompt is white
PS1="\[\e[02;37m\][\D{%b %d} \A]\[\e[00m\] \[\e[01;32m\]\u\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\] $"
@philiprenich
philiprenich / simple-grid-framework-mixin.scss
Created January 4, 2023 20:50
A very basic example of using SCSS to create a basic CSS grid system, without the use of a large framework. Not yet used in production, so there are sure to be many use-cases unaccounted for, but it gets you a starting point.
@mixin grid($columns: 12, $use-classes: false) {
.grid {
display: grid;
grid-template-columns: repeat($columns, 1fr);
}
.grid > * {
order: $columns + 1;
}