Skip to content

Instantly share code, notes, and snippets.

View sneakyness's full-sized avatar
💭
Rolling up to the function like a stretched out Steve Ballmer

Nick Pannuto sneakyness

💭
Rolling up to the function like a stretched out Steve Ballmer
View GitHub Profile
#!/usr/bin/perl
# This filter changes all words to Title Caps, and attempts to be clever
# about *un*capitalizing small words like a/an/the in the input.
#
# The list of "small words" which are not capped comes from
# the New York Times Manual of Style, plus 'vs' and 'v'.
#
# 10 May 2008
# Original version by John Gruber:
@JeOam
JeOam / Animation.md
Last active February 18, 2024 21:18
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

@iMokhles
iMokhles / How to use the old prefs method within sandbox apps
Last active August 29, 2015 14:14
How to use the old prefs method within sandbox apps
static BOOL tweakEnabled = NO;
static void PreferencesChangedCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
system("killall WhatsApp"); // kill app to apply changes ;)
NSDictionary *preferences = [[NSDictionary alloc] initWithContentsOfFile:@"TWEAK_PREFS_PATH"];
tweakEnabled = [preferences[@"tweakEnabled"] boolValue];
}
%ctor {
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidFinishLaunchingNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *block) {
@iMokhles
iMokhles / CFPreferencesAppSynchronize with ARC and non ARC.xm
Last active August 16, 2020 13:28
How to use CFPreferencesAppSynchronize with ARC and non ARC (iOS8 Tweaks) + CFNotificationCallback (option) Works fine with Sandbox Apps
static BOOL tweakEnBOOL;
#define SETTINGSFILENEW "com.imokhles.Prefs"
#define PREFERENCES_CHANGED_NOTIFICATION "com.imokhles.Prefs.preferences-changed"
// non ARC
static void iMoLoadPreferences() {
CFPreferencesAppSynchronize(CFSTR(SETTINGSFILENEW));
tweakEnBOOL = !CFPreferencesCopyAppValue(CFSTR("Enabled"), CFSTR(SETTINGSFILENEW)) ? YES : [(id)CFBridgingRelease(CFPreferencesCopyAppValue(CFSTR("Enabled"), CFSTR(SETTINGSFILENEW))) boolValue];
}
@conatus
conatus / ello.md
Last active April 13, 2023 19:32
Ello API

Ello API

This is a basic exploration of the Ello API. Completely unofficial, your mileage my vary, don't smash their servers as they are likely very busy.

Methods return HTML for their representation where appropriate which is a nice little pattern. Everything returns application/json.

Like this:

{
 "id": ,
@Whelton
Whelton / gradients_maths_and_insanity.md
Created September 21, 2014 21:12
Gradients, Maths and Insanity

Here a quick thought of insanity before I leave the office at ~1.05am. I dwell and fret over design, particularly when its me making the decision, to the point of insanity (a recurring theme here).

If I have a base color, I use Adobe's Kuler to get matching colors (with some rule depending) or I checkout ColourLovers to use a platte crafted by someone with a keener eye than I. Similarly I use a typography calculator to define font sizes relative to each other and so on, so on. I have a whole bunch of these rules and methods I use so I can sleep easier knowing there is method behind my design choices.

Heres one I came up against just there, I wanted to put in a nice gradient as background in something I'm building at the moment, like anyone else who is a regular connoisseur of GitHub's trending repos, I stumbled across uiGradients ([Repo](https://git

Stealing WiFi

/etc/hosts

This will let you access any google owned site. This includes: youtube, google cache, google translate, google search, gmail, google news, etc.

  • Install the HTTPS Everywhere extension
  • Add these rules to your /etc/hosts file
@nicklockwood
nicklockwood / gist:7559729
Last active April 27, 2016 16:18
A proposal for an alternative NSNotificationCenter API that doesn't suck

Method

- (void)addObserver:(id)observer
            forName:(NSString *)name
             object:(id)object
              queue:(NSOperationQueue *)queue
         usingBlock:(void (^)(NSNotification *note, __weak id observer))block;

Usage

@coffeemug
coffeemug / gist:6168031
Last active February 3, 2022 23:16
The fun of implementing date support
After spending the better part of the month implementing date support
in RethinkDB, Mike Lucy sent the team the following e-mail. It would
have been funny, if it didn't cause thousands of programmers so much
pain. Read it, laugh, and weep!
-----
So, it turns out that we're only going to support dates between the
year 1400 and the year 10000 (inclusive), because that's what boost
supports.
@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \