Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am spilliams on github.
  • I am spilliams (https://keybase.io/spilliams) on keybase.
  • I have a public key ASC-nLvw0qxmNspUoeU6mbw2vV9bR5UCHGEA1agrDefGQwo

To claim this, I am signing this object:

@spilliams
spilliams / xy.rb
Created June 27, 2014 17:35
spits out xy coordinates of points on a circle given its properties
# simple ruby script to spit out x,y coords of points on a circle given properties
require "highline/import"
radius = Float(ask "radius? ")
originX = Float(ask "X coord of center? ")
originY = Float(ask "Y coord of center? ")
minTheta = Float(ask "minTheta (deg)? ") * Math::PI/180
maxTheta = Float(ask "maxTheta (deg)? ") * Math::PI/180
dTheta = Float(ask "dTheta (rad)? ") * Math::PI/180

You're about to start a library or open-source thing that you want to be available to any iOS project. This is a handy guide for how to get set up.

#Setup

  1. start a new Xcode project with "Empty Application"
  2. project settings: verify name, devices (probably want Universal), Core Data (probably not), ARC (probably)
  3. choose location, don't add to any workspace or project.

Ok, project exists. What now? Let's rip out all that boilerplate Xcode so graciously gave us.

@spilliams
spilliams / 1_iOS_bootstrap.md
Last active December 14, 2015 17:09
steps for bootstrapping an iOS project

#Bootstrapping An iOS App

Note: If you're bootstrapping a static lib project, read this gist instead.

##Project Setup

  1. New xcode project (including save to directory).
  2. Set devices and iOS target
  3. decide if you're going to use Autolayout (set in the Storyboard > File inspector > Interface Builder Document section)
  4. Create Constants.h, and #import "Constants.h" in the PCH
@spilliams
spilliams / SWAppDelegate.h
Created January 18, 2013 02:08
lock state notifications test
//
// SWAppDelegate.h
// lockstatenotificationstest
//
// Created by Spencer Williams on 1/17/13.
// Copyright (c) 2013 Spencer Williams. All rights reserved.
//
#import <UIKit/UIKit.h>
@spilliams
spilliams / magicks.css
Created June 21, 2012 00:23
css magicks!
/* flag links that don't go anywhere */
a[href = ""] {
background: red;
color: white;
font-size: x-large;
}
/* flag absolute links */
@spilliams
spilliams / mobile.css
Created June 11, 2012 22:07
Responsive Breakpoints Boilerplate
.show_on_phones, .show_on_tablets, .hide_on_desktop {
display: none;
}
@media only screen and (max-width: 768px) and (min-width: 481px) {
/* tablets only */
.show_on_tablets {
display: block;
}
.show_on_desktop, .hide_on_tablets {
@spilliams
spilliams / jquery.boilerplate.js
Created June 6, 2012 13:05
Boilerplate jQuery Plugin. Copypasta.
// replace instances of "myPlugin" with your plugin name
(function($){
var methods = {
init : function( options ) {
var defaults = {
};
var options = $.extend(defaults,options)
return this.each(function() {
@spilliams
spilliams / leaflet_numbered_markers.css
Created May 23, 2012 23:55 — forked from comp615/leaflet_numbered_markers.css
Numbered Markers in Leaflet (JS Mapping)
.leaflet-marker-pane .leaflet-clickable {
position: absolute;
top: -55px; /* depends on icon graphic */
left: -17px; /* depends on icon graphic */
}
.leaflet-marker-pane .leaflet-clickable .number {
position: absolute;
top: 10px; /* depends on icon graphic */
width: 34px; /* depends on icon graphic */
text-align: center;
@spilliams
spilliams / Templater.js
Created May 23, 2012 02:06 — forked from bryfox/Templater.js
One variation on simple JS templating
/*global document */
(function (ctx) {
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
(function(){
var cache = {};
function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.