Skip to content

Instantly share code, notes, and snippets.

View BrandonShega's full-sized avatar

Brandon Shega BrandonShega

View GitHub Profile
@IanKeen
IanKeen / AnyCodable.swift
Last active March 4, 2021 18:45
AnyCodable
public struct AnyCodable: Codable {
public let value: Any?
public init(_ value: Any?) {
self.value = value
}
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
@pchan37
pchan37 / install_emacs.sh
Last active October 24, 2020 13:55
Install Emacs on Elementary OS
#!/bin/bash -e
sudo apt update -y
sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-elisp/ppa -y
sudo apt update && sudo apt install emacs25
# emacs25.desktop:
cp /usr/share/applications/emacs25.desktop ~/.local/share/applications
# Replace the Exec line with: Exec=Exec=/usr/bin/env XLIB_SKIP_ARGB_VISUALS=1 emacsclient -a '' -n -c %F
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active July 14, 2024 18:27
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install [email protected]
brew unlink [email protected]
brew link postgresql
@nathanhillyer
nathanhillyer / .gitignore
Created May 12, 2016 16:26
Swift gitignore
#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"
@michaelochs
michaelochs / LocalNotifications.m
Last active August 29, 2015 14:23
Short snipped with an explanation of how your app needs to respond to local notifications.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UILocalNotification *localNotification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotification) {
// the user opened your app by tapping either the notification banner, the notification
// center entry or the open action in the alert view of the notification while your app
// was not running / suspended.
// This is where you want to react to the user's action!
}
}
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active November 2, 2024 08:30
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName