Skip to content

Instantly share code, notes, and snippets.

@Ravi61
Ravi61 / CustomDateCoding.swift
Created July 13, 2017 15:16
Custom Date Encoding/Decoding
// Custom Date Decoding
jsonDecoder.dateDecodingStrategy = .custom({ (decoder) -> Date in
let data = try decoder.singleValueContainer().decode(String.self)
//perform your operation on obtained string
let disturbance = "01-07-1977"
let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-yyyy"
if data == "First disturbance in force" {
return formatter.date(from: disturbance) ?? Date()
} else {
@r4dian
r4dian / Unfollow.js
Created October 16, 2017 11:13
Unfollow everything & everyone on Facebook.
// Manual set-up
// click: ▼ at top-right
// Newsfeed preferences
// "Unfollow people to hide their posts" (also includes all Pages, which are not real "people")
// Scroll to the bottom of that so they are all listed
// Open console (f12, or whatever the fuck on MacOS) and paste these two lines:
var e = document.querySelectorAll("._5u3n");
e.forEach(function(elem){ elem.click() });
@ytyubox
ytyubox / README.md
Last active December 21, 2021 08:31
UIControlSubscription.swift
@apsun
apsun / duplicity-backup.md
Last active May 12, 2025 05:40
Backup files using duplicity to Backblaze B2

This gist has graduated to a full-fledged project! All future updates will happen in the repo; this gist is no longer maintained.

duplicity -> Backblaze B2

Daily systemd timer to backup the contents of my filesystem to Backblaze B2. As-written, it will keep up to a year's worth of backups, performing one full backup every month. This script was tested with duplicity 3.0.3.