Skip to content

Instantly share code, notes, and snippets.

View Jon-Schneider's full-sized avatar

Jon Schneider Jon-Schneider

View GitHub Profile
@Jon-Schneider
Jon-Schneider / Get iOS contacts sorted by First Name or Last Name
Last active December 21, 2015 14:38
A bug in the iOS Address Book library returns contacts in the wrong alphabetical sort order when requesting them by First or Last name. I wrote this code as a way to do my own sort of all contacts. This method will sort by first or last name based on an NSUserDefault bool, falling back onto their company name if the contact has no first or last …
#pragma mark - All Contacts list sort handling function and method.
CFComparisonResult ABPersonComparePeopleByIdentifier (ABRecordRef person1, ABRecordRef person2, ABPersonSortOrdering ordering) {
NSString *firstName1 = (__bridge NSString *)ABRecordCopyValue(person1, kABPersonFirstNameProperty);
NSString *lastName1 = (__bridge NSString *)ABRecordCopyValue(person1, kABPersonLastNameProperty);
NSString *orgName1 = (__bridge NSString *)ABRecordCopyValue(person1, kABPersonOrganizationProperty);
NSString *identifier1;
BOOL firstNameSortingIsOn = [[NSUserDefaults standardUserDefaults] boolForKey:@"first-name-sort"];
```
root@5ff360c597d8:/TestApp# rails s -p 3333
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3333
=> Run `rails server -h` for more startup options
[Listen warning]:
Listen will be polling for changes. Learn more at https://github.com/guard/listen#polling-fallback.
Exiting
An exception occurred running bin/rails
@Jon-Schneider
Jon-Schneider / wav_header.h
Created November 29, 2016 15:59
C Wav Header Struct
// WAV header spec information:
//https://web.archive.org/web/20140327141505/https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
//http://www.topherlee.com/software/pcm-tut-wavformat.html
typedef struct wav_header {
// RIFF Header
char riff_header[4]; // Contains "RIFF"
int wav_size; // Size of the wav portion of the file, which follows the first 8 bytes. File size - 8
char wave_header[4]; // Contains "WAVE"
@Jon-Schneider
Jon-Schneider / iCLA.txt
Last active February 16, 2017 18:02
LISNR Individual CLA
LISNR Individual Contributor License Agreement
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to LISNR, inc. ("LISNR"). Except for the license granted herein to LISNR and recipients of software distributed by LISNR, You reserve all right, title, and interest in and to Your Contributions.
1. Definitions.
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with LISNR. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"Contribution" s
@Jon-Schneider
Jon-Schneider / styles.css
Created March 16, 2017 18:35
CSS for an App Store Install Button
/* Scale as needed */
#install-button {
font-family:arial;
font-size:14pt;
letter-spacing: 1px;
padding-top:7px;
padding-bottom:7px;
padding-left:12px;
padding-right:12px;
# A quick and dirty ruby script to update the creation and modified date of files.
# I use it before uploading to Google Photos.
# Just drop it into the directory your files are in.
# Currently based on the format '2016-08-20_21-54-44_000.ext' but this can be modified'
Dir.foreach('.') do |item|
next if item == '.' or item[0] == "." or item == '..' or item == "update_times.rb"
dateAndTime = item.split('_')
date = dateAndTime[0].split('-')
time = dateAndTime[1].split('-')
Amazon: https://amazon.com/s?k=%s
Amazon Orders: https://amazon.com/gp/your-account/order-history/ref=ppx_yo_dt_b_search?opt=ab&search=%s
Gmail: https://mail.google.com/mail/u/0/#search/%s
Home Depot: https://www.homedepot.com/s/%s
MSW: https://microsoft.sharepoint.com/_layouts/15/search.aspx/?q=%S
Reddit on Google: https://google.com/search? q=reddit+%s (Note 'reddit' is hardcoded in query param)
Walmart: https://www.walmart.com/search?q=%s
Walmart Orders: https://www.walmart.com/orders?searchTerm=%s
Wikipedia: https://en.wikipedia.org/wiki/Special:Search/%s
// Scroll
settings.map('j', VLCommand.HALF_PAGE_DOWN);
settings.map('k', VLCommand.HALF_PAGE_UP);
settings.map('f', VLCommand.HALF_PAGE_DOWN);
settings.map('d', VLCommand.HALF_PAGE_UP);
settings.map('g', VLCommand.SCROLL_TO_TOP);
settings.map('shift+g', VLCommand.SCROLL_TO_BOTTOM);
// Normal mode
settings.map('v', VLCommand.ACTIVATE_LINK);
@Jon-Schneider
Jon-Schneider / SplitViewController.txt
Last active August 23, 2023 03:15
Programmatic UISplitViewController Example
//
// ViewController.swift
// SplitView
//
// Created by Jon Schneider on 8/21/23.
//
import UIKit
class SplitViewController: UISplitViewController {