Skip to content

Instantly share code, notes, and snippets.

import PlaygroundSupport
import SwiftUI
extension UIView {
var renderedImage: UIImage {
let image = UIGraphicsImageRenderer(size: self.bounds.size).image { context in
UIColor.lightGray.set(); UIRectFill(bounds)
context.cgContext.setAlpha(0.75)
self.layer.render(in: context.cgContext)
}
return image
@dzuluaga
dzuluaga / install-oh-my-zsh-gcp-cloud-shell.sh
Last active April 29, 2024 16:55
Installs oh-my-zsh on GCP Cloud Shell in a single command.
#!/usr/bin/env bash
# Installs oh-my-zsh on GCP Cloud Shell in a single command.
# Run this script directly from the command line
#
# $ curl "https://gist.githubusercontent.com/dzuluaga/3bf775217728debf360a4377c7eb5118/raw/install-oh-my-zsh-gcp-cloud-shell.sh?$(date +%s)" | sudo bash
#
# you can also append an alias to ~/.bashrc to install-zsh at anytime
#
# alias install-zsh="curl \"https://gist.githubusercontent.com/dzuluaga/3bf775217728debf360a4377c7eb5118/raw/install-oh-my-zsh-gcp-cloud-shell.sh?$(date +%s)\" | sudo bash"
@skagedal
skagedal / simulator.zsh
Last active February 15, 2021 14:42
Extension for zsh that gives an auto-completable cd to a simulator data container of the app with the given bundle identifier.
# Extension for zsh that cd to a simulator data container of the app with the given bundle identifier.
#
# See blog post at https://skagedal.github.io/2018/01/02/simcd.html
function simdir () {
xcrun simctl get_app_container booted $1 data
}
function simcd () {
cd `simdir $1`
@csswizardry
csswizardry / README.md
Last active April 2, 2024 20:17
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
@ecridge
ecridge / link-icloud-drive.sh
Created October 2, 2016 17:47
Add a symbolic link to iCloud Drive in Bash on macOS.
@hlissner
hlissner / lb6.js
Last active January 20, 2022 16:36
LaunchBar 6 API stubs (for ternjs)
/**
* LaunchBar Javascript API (see http://www.obdev.at/products/launchbar/index.html)
*
* For use with auto-completion libraries.
*/
// Included to hide "unused function" warnings
run();
runWithItem({});
runWithPaths({});
@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.