Skip to content

Instantly share code, notes, and snippets.

View Michael-Lfx's full-sized avatar

LaiFX Michael-Lfx

  • Beijing, China
View GitHub Profile
@Michael-Lfx
Michael-Lfx / ramdisk.sh
Created January 11, 2021 17:05 — forked from bzz/ramdisk.sh
ramdisk create/delete on Mac OS X.
#!/bin/bash
# From http://tech.serbinn.net/2010/shell-script-to-create-ramdisk-on-mac-os-x/
#
ARGS=2
E_BADARGS=99
if [ $# -ne $ARGS ] # correct number of arguments to the script;
then
@Michael-Lfx
Michael-Lfx / CrossPlatformImages.swift
Created October 27, 2020 03:54 — forked from JohnSundell/CrossPlatformImages.swift
An easy way to make code that uses UIImage cross-platform between iOS/tvOS & macOS
// Either put this in a separate file that you only include in your macOS target
// or wrap the code in #if os(macOS) / #endif
import Cocoa
// Step 1: Typealias UIImage to NSImage
typealias UIImage = NSImage
// Step 2: You might want to add these APIs that UIImage has but NSImage doesn't.
extension NSImage {
@Michael-Lfx
Michael-Lfx / terminal-git-branch-name.md
Created October 21, 2020 07:03 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {