Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View matthewpalmer's full-sized avatar

Matthew Palmer matthewpalmer

View GitHub Profile
@vilhalmer
vilhalmer / gist:3052f7e9e7f34b92a40f
Created November 1, 2014 01:28
NSVisualEffectView undocumentation
NSVisualEffectMaterial constants, and the undocumented materials they coorespond to in various modes:
+----------------------+-------+----------+------+---------+
| MATERIAL # | LIGHT | LIGHT EM | DARK | DARK EM |
+----------------------+-------+----------+------+---------+
| | | | | |
| 0 - Appearance Based | 3 | 3 | 5 | 5 |
| | | | | |
| 1 - Light | 3 | 3 | 3 | 3 |
| | | | | |
| 2 - Dark | 4 | 4 | 4 | 4 |
@mwermuth
mwermuth / UIBezier+Arrow.swift
Created September 11, 2014 14:01
Drawing an Arrow with Swift
extension UIBezierPath {
class func getAxisAlignedArrowPoints(inout points: Array<CGPoint>, forLength: CGFloat, tailWidth: CGFloat, headWidth: CGFloat, headLength: CGFloat ) {
let tailLength = forLength - headLength
points.append(CGPointMake(0, tailWidth/2))
points.append(CGPointMake(tailLength, tailWidth/2))
points.append(CGPointMake(tailLength, headWidth/2))
points.append(CGPointMake(forLength, 0))
points.append(CGPointMake(tailLength, -headWidth/2))
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"More" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// maybe show an action sheet with more options
[self.tableView setEditing:NO];
}];
moreAction.backgroundColor = [UIColor lightGrayColor];
UITableViewRowAction *blurAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Blur" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView setEditing:NO];
}];
@warnergodfrey
warnergodfrey / gist:7512051
Last active September 21, 2018 03:20
Access the ATO Business Portal using AusKey Mac OS X Mountain Lion
  • Install the latest JRE from Oracle
  • In the Java Control Panel, go to the Security tab and make sure 'Enable Java Content' is checked
  • Open Safari
  • Go to the ATO Business portal site https://bp.ato.gov.au/BpStatics/homepage.htm
  • Click Login
  • A dialog will apear asking you 'Do you want to trust the website “authentication.business.gov.au” to use the “Java” plug-in?'
  • Click 'Trust'
  • Now you will be asked 'Do you want to run this application?'
  • Click 'Run'
  • Another dialog will appear asking you to 'Allow access to the following application from this website?'
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@romaonthego
romaonthego / NSDateFormatter cheat sheet
Last active February 14, 2024 22:10
Date Formats for NSDateFormatter
a: AM/PM
A: 0~86399999 (Millisecond of Day)
c/cc: 1~7 (Day of Week)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
d: 1~31 (0 padded Day of Month)
D: 1~366 (0 padded Day of Year)
@mayoff
mayoff / makeAnimatedGif.m
Created February 16, 2013 23:00
Example of creating an animated GIF on iOS, with no 3rd-party code required. This should also be easy to port to OS X.
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@al3x
al3x / newpost.rb
Created April 22, 2009 23:50
Handy new post script for Jekyll blogs or similar
#!/usr/bin/env ruby
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
date_prefix = Time.now.strftime("%Y-%m-%d")
postname = ARGV[0].strip.downcase.gsub(/ /, '-')
post = "/Users/al3x/src/al3x.github.com/_posts/#{date_prefix}-#{postname}.textile"