Skip to content

Instantly share code, notes, and snippets.

@Qata
Qata / JSON.swift
Last active April 18, 2019 00:27
A JSONDecoder that wraps a JSONParser that isomorphically preserves the values of floating point numbers by treating all numbers as strings until instantiation of the exact type.
import Foundation
public indirect enum JSON: Equatable {
case null
case string(String)
case number(String)
case bool(Bool)
case dictionary([String: JSON])
case array([JSON])
}
// Dark Mode
#FFFEFE rgba(255, 254, 254, 0.847) hsla(320, 0%, 100%, 0.847) labelColor
#FFFEFE rgba(255, 254, 254, 0.549) hsla(320, 0%, 100%, 0.549) secondaryLabelColor
#FFFEFE rgba(255, 254, 254, 0.247) hsla(320, 0%, 100%, 0.247) tertiaryLabelColor
#FFFEFE rgba(255, 254, 254, 0.098) hsla(320, 0%, 100%, 0.098) quaternaryLabelColor
#3486FE rgba(52, 134, 254, 1.000) hsla(215, 79%, 99%, 1.000) linkColor
#FFFEFE rgba(255, 254, 254, 0.498) hsla(320, 0%, 100%, 0.498) placeholderTextColor
#FFFEFE rgba(255, 254, 254, 0.847) hsla(320, 0%, 100%, 0.847) windowFrameTextColor
#FFFEFE rgba(255, 254, 254, 1.000) hsla(320, 0%, 100%, 1.000) selectedMenuItemTextColor
// Copy & paste this is code in Javascript Console when logged into Search Ads
// When executed you'll get phrase and numeral search popularity for each keyword
// Example: https://www.dropbox.com/s/iuuk8uipwnpvnn6/searchads.png?dl=0
$('td.iad-keyword').each(function(idx, value) {
var keyword = value.innerHTML;
var searchVolume = value.nextSibling.childNodes[0].childNodes[0].childNodes[0].innerHTML;
console.log(keyword + ' : ' + searchVolume.replace(' Complete', ''));
});
@chockenberry
chockenberry / finder_icons.sh
Last active February 10, 2024 19:05
A simple shell script to turn the Finders desktop icons on and off
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
@daneden
daneden / Instructions.md
Created December 1, 2015 00:25
Remap Caps Lock to Emoji on Mac

How to remap the caps lock key to the emoji selector on Mac

  1. Go to System Preferences -> Keyboard -> Modifier Keys...
  2. Change “Caps Lock” to “No action”
  3. Install Seil
  4. Change the Caps Lock key in Seil to keyCode 80 (F19)
  5. Install Karabiner
  6. Open Karabiner and go to Misc & Uninstall -> Open private.xml
  7. Copy the contents of this gist's example to the XML file and save
  8. In Karabiner, go to Change Keys -> Reload XML
@nickfrey
nickfrey / WFSimulate3DTouchPreview.m
Created September 22, 2015 20:13
Test 3D Touch peek/pop using private APIs
@interface UIPreviewForceInteractionProgress : NSObject
- (void)endInteraction:(BOOL)arg1;
@end
@interface UIPreviewInteractionController : NSObject
@property (nonatomic, readonly) UIPreviewForceInteractionProgress *interactionProgressForPresentation;
@steipete
steipete / gist:99f8aa8d6527fa027fd6
Last active August 29, 2015 14:25
Mirror for https://forums.developer.apple.com/thread/11098 since that needs moderation first (submitted Jul 16 2015)
We're working on supporting Bitcode in PSPDFKit but hit a blocking issue with OpenSSL (latest 1.0.2d).
We're using a script that downloads and builds OpenSSL into fat static libraries for both Mac and iOS. I've put the gist here:
https://gist.github.com/steipete/ce09ba176a4b8ef66b2d/bf053eab1c0f8494dcd3748079543c4ed4367b9c
Enabling Bitcode should be as easy as adding `-fembed-bitcode` as clang flag according to this entry. That's exactly what I did.
Now things build, but the script eventually stops with this error:
ld: could not open bitcode temp file: ../libcrypto.a(aes-x86_64.o) for architecture x86_64
@steipete
steipete / openssl-build.h
Last active May 30, 2023 11:34
Updated script that builds OpenSSL with Bitcode enabled (tested with Xcode 7.0b3)
#!/bin/bash
# This script downlaods and builds the iOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# Peter Steinberger, PSPDFKit GmbH, @steipete.
set -e
@lisamelton
lisamelton / convert-mkv-to-mp4.sh
Last active October 17, 2021 13:51
Convert Matroska video file into MP4 format without transcoding.
#!/bin/bash
#
# convert-video.sh
#
# Copyright (c) 2013-2014 Don Melton
#
about() {
cat <<EOF
$program 2.0 of December 3, 2014
@ncreated
ncreated / PrintLocalesController.m
Last active July 1, 2025 08:38
List of iOS locales with currency formatting.
//
// PrintLocalesController.m
// NSFormatterTest
//
// Created by Maciek Grzybowski on 02.04.2014.
//
#import "PrintLocalesController.h"
@interface PrintLocalesController ()