Skip to content

Instantly share code, notes, and snippets.

View mgrider's full-sized avatar

Martin Grider mgrider

View GitHub Profile
//
// KSDIdlingWindow.h
//
// Created by Brian King on 4/13/10.
// Copyright 2010 King Software Designs. All rights reserved.
//
// Based off:
// http://stackoverflow.com/questions/273450/iphone-detecting-user-inactivity-idle-time-since-last-screen-touch
//
// call when zoom level or page size changes (i.e. after zooming or after rotation)
- (void)updateContentInsetForPageScrollView:(UIScrollView *)pageScrollView {
UIImageView *imageView = (UIImageView *) [pageScrollView viewWithTag:TAG_IMAGE_VIEW];
CGFloat zoomScale = pageScrollView.zoomScale;
CGSize imageSize = imageView.bounds.size;
CGSize zoomedImageSize = CGSizeMake(imageSize.width * zoomScale, imageSize.height * zoomScale);
CGSize pageSize = pageScrollView.bounds.size;
@jboner
jboner / latency.txt
Last active October 19, 2024 01:37
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nciske
nciske / rfps-are-lame.md
Last active February 16, 2017 15:00
A response to RFP requests

I would love to work with you, and I think I have a lot of experience that is very relevant to your project, but developing a proposal in response to an RFP takes a significant amount of time for which I am not compensated (if not awarded the project).

Because I am an independent development shop and generally have plenty of work booked ahead of time, I typically do not participate in the RFP process. Here are a few reasons why:

  1. I do consultative sales which an RFP process hinders significantly (e.g. I can’t do this without a commitment to work with me)
  2. RFPs rarely state the goals and needs of the project effectively -- I prefer to work within your budget to plan and deliver the best possible outcome.
  3. RFPs cost time and money to respond to and generally inflate project budgets -- I prefer to spend that time working with clients and passing those savings onto them.

If you wish to engage me as your website development partner, I'm happy talk about your budget and needs. Once those are clarified I ca

@AnuragMishra
AnuragMishra / DateParsingPerformanceComparison.m
Last active July 29, 2020 17:20
Compare the date parsing performance of NSDateFormatter against SQLite's date parser for parsing an iOS 8601 date.
#import <Foundation/Foundation.h>
#import "sqlite3.h"
typedef int64_t timestamp;
NSUInteger randomNumberInRange(NSUInteger start, NSUInteger end);
// Create a sample date using the ISO-8601 format.
// 2013-04-23T16:29:05Z
NSString* generateSampleDate();
@anoved
anoved / star.scad
Created March 18, 2014 15:48
OpenSCAD pointed star module
// points = number of points (minimum 3)
// outer = radius to outer points
// inner = radius to inner points
module Star(points, outer, inner) {
// polar to cartesian: radius/angle to x/y
function x(r, a) = r * cos(a);
function y(r, a) = r * sin(a);
// angular width of each pie slice of the star
@Lerg
Lerg / prepare_icons.sh
Last active April 11, 2024 19:25
Make all app icons with imagemagick, iOS and Android
#!/bin/sh
base=$1
convert "$base" -resize '29x29' -unsharp 1x4 "Icon-Small.png"
convert "$base" -resize '40x40' -unsharp 1x4 "Icon-Small-40.png"
convert "$base" -resize '50x50' -unsharp 1x4 "Icon-Small-50.png"
convert "$base" -resize '57x57' -unsharp 1x4 "Icon.png"
convert "$base" -resize '58x58' -unsharp 1x4 "Icon-Small@2x.png"
convert "$base" -resize '60x60' -unsharp 1x4 "Icon-60.png"
convert "$base" -resize '72x72' -unsharp 1x4 "Icon-72.png"
convert "$base" -resize '76x76' -unsharp 1x4 "Icon-76.png"
@enjrolas
enjrolas / L3D file format.md
Last active August 29, 2015 14:08
L3D file format specification

L3D format for color volumetric data

revision 1

The L3D format is a simple, bitmap-like format for representing volumetric color data. The color of each voxel is represented as an R,G,B triplet. This revision does not support compression, making it unfeasible for large volumes, but suitable for small volumes, like those seen in LED cubes.

File contents:

A sample file is shown below, and this document will go into detail on the different options for every line.

@ianfitzpatrick
ianfitzpatrick / walker_es6.js
Last active July 7, 2017 21:13
walker_es6.js
// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
let walker
function setup() {
createCanvas(640,360)
walker = new Walker()
background(127)
@dpid
dpid / how-to-notarize-unity-for-macos.md
Last active December 6, 2023 20:42
How to notarize a Unity build for MacOs 10.15 Catalina

How to notarize a Unity build for macOs 10.15 Catalina

As of January 2020, all apps running on macOs 10.15 Catalina are required to be notarized. For Unity games distributed outside the Mac App Store, such as with Steam, the notarization process is done post build using a series of Xcode command line tools.

Prerequisites

  • a Mac that is compatible with macOs 10.15 Catalina :
    • MacBook (2015 or newer)
    • MacBook Air (2012 or newer)
  • MacBook Pro (2012 or newer)