Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jlnr's full-sized avatar

Julian Raschke jlnr

View GitHub Profile

Fixing macOS 10.14, 10.15, 12

Dark main menu without the rest of dark mode

  1. Set Light mode
  2. defaults write -g NSRequiresAquaSystemAppearance -bool Yes
  3. Log out and log back in
  4. Set Dark mode
@futuretap
futuretap / NSDate+Additions.m
Created March 22, 2018 10:22
relative time formatter
- (NSString*)localizedRelativeTime {
NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
formatter.allowedUnits = NSCalendarUnitHour | NSCalendarUnitMinute;
formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleShort;
if (self.timeIntervalSinceNow < 60 && self.timeIntervalSinceNow > -60) {
return NSLocalizedString(@"right now", @"from MapKit/Maps");
} else if (self.timeIntervalSinceNow > 0) {
NSString *start = [formatter stringFromDate:NSDate.date toDate:self];
return [NSString stringWithFormat:NSLocalizedString(@"in %@", @"placeholder: minutes/hours"), start];
} else {
@mbinna
mbinna / effective_modern_cmake.md
Last active April 18, 2024 19:26
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@sebastianludwig
sebastianludwig / jira.css
Last active June 24, 2021 13:32
User CSS to increase JIRA's and GitHub's information desity
/* GitHub */
/* project view */
/* pack columns tighter together */
div.project-columns-container > div {
margin-right: 8px !important;
}
/* reduce card to column spacing */
@mikezila
mikezila / tilesheet.rb
Created March 2, 2017 19:28
TileSheet class for Gosu in Ruby
# tilesheet.rb
#
# This is for loading tile sheets that either have padding between the tiles,
# do not take up the whole of the image, or both. The normal Gosu method for
# loading from tiles doesn't work if there is padding or the tiles themselves
# are not wall-to-wall on the sheet. This can load such a sheet, though you
# will need to know how many tiles there are both wide and tall, as there's no
# way to guess on such a sheet. You'll also need to make sure the sheet is a
# power-of-two in size. You can do this by adjusting the sheet to 512x512 or
# 1024x1024, just add empty space if needed.
@0xced
0xced / NSJSONSerializationError.m
Created January 22, 2016 16:23
Convoluted way to get [NSJSONSerialization dataWithJSONObject:options:error:] to return an error
// http://twitter.com/nicklockwood/status/690540488433274881
// @0xced hmm, you're right. So under what circumstances *does* it populate the error param? Why even have it at all?
// http://twitter.com/0xced/status/690543445404991488
// @nicklockwood Just disassembled again, seems it can errors if a string fails to convert to UTF8. @nst021 Idea how to produce such a string?
// http://twitter.com/mikeash/status/690564095322542081
// mikeash: @0xced @nicklockwood @nst021 Maybe try an NSString containing half of a surrogate pair.
#import <Foundation/Foundation.h>
@imneme
imneme / randutils.hpp
Last active March 28, 2024 20:43
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
/*
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Melissa E. O'Neill
*
@steipete
steipete / gist:8df39fea0d39680a7a6b
Last active September 17, 2020 23:24
Hunting down a regression in interface rotation on iOS 8 with multiple windows. (rdar://19592583)
This is the code path that changed the status bar orientation on iOS 7:
* thread #1: tid = 0x698dbf, 0x00085830 WindowRotationIssue`-[AppDelegate application:willChangeStatusBarOrientation:duration:](self=0x7a041f90, _cmd=0x0137a18d, application=0x79e39cc0, newStatusBarOrientation=UIInterfaceOrientationPortraitUpsideDown, duration=0.80000000000000004) + 96 at AppDelegate.m:23, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
* frame #0: 0x00085830 WindowRotationIssue`-[AppDelegate application:willChangeStatusBarOrientation:duration:](self=0x7a041f90, _cmd=0x0137a18d, application=0x79e39cc0, newStatusBarOrientation=UIInterfaceOrientationPortraitUpsideDown, duration=0.80000000000000004) + 96 at AppDelegate.m:23
frame #1: 0x00bb6ab5 UIKit`-[UIApplication setStatusBarOrientation:animationParameters:notifySpringBoardAndFence:] + 242
frame #2: 0x00bfa8e4 UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 4761
frame #3: 0x00bf9646 UIKit`-[UIWi
@mattt
mattt / nshipster-new-years-2015.md
Created November 25, 2014 19:38
NSHipster New Year's 2015

Season's Greetings, NSHipsters!

As the year winds down, and we take a moment to reflect on our experiences over the past months, one thing is clear: 2014 has been an incredible year professionally for Apple developers. So much has happened in such a short timespan, and yet it's hard to remember our relationship to Objective-C before Swift, or what APIs could have captivated our imagination as much as iOS 8 or WatchKit.

It's an NSHipster tradition to ask you, dear readers, to send in your favorite tips and tricks from the past year for publication over the New Year's holiday. This year, with the deluge of new developments—both from Cupertino and the community at large—there should be no shortage of interesting tidbits to share.

Submit your favorite piece of Swift or Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

If you're wondering about what to post, look to

@jsomers
jsomers / websters-kindle.mdown
Created May 19, 2014 01:42
How to make the Webster's 1913 your default Kindle dictionary

How to make the Webster's 1913 your default Kindle dictionary

  1. Download a Kindle-compatible version of the dictionary here. Unzip the .rar archive.

  2. Get the "Send to Kindle" program on your computer. Here's the link for the Mac.

  3. Right-click your recently downloaded (unzipped) dictionary file, and click the "Send to Kindle" menu item. It will arrive on your Kindle shortly.

  4. Once the dictionary has arrived, go to your settings -- on my newish paperwhite, it's at Home > Settings > Device Options > Language and Dictionaries > Dictionaries > English. Choose the Webster's 1913.