Skip to content

Instantly share code, notes, and snippets.

FOR IMMEDIATE RELEASE

## AppName vX.X does something interesting

AppName vX.X is on the App Store now, and features the following very interesting feature. This is a summary, so I'm focusing on the lead. Just something to make me want to read the rest. Done.

City, State/Country - [Company/Developer] has released AppName vX.X, available in the Mac App Store. AppName is/does [broad, general strokes]. [A few more specific points about who it's for and why it's of benefit to them].

New features!
@nomatteus
nomatteus / gist:4546816
Last active December 11, 2015 04:39
List all font names (useful for finding the font name of custom fonts added to project).
// TTF or OTF fonts are supported.
// Drag font into project, and copy into target.
// Add this to [App]-Info.plist: "Fonts provided by application"
// Add all font filenames to this property (i.e. "my_font.ttf" or "fontName.otf")
// Use font in your code! (Get the name using the code below; it won't always be the same as the filename.)
// Lists all font names
for ( NSString *familyName in [UIFont familyNames] ) {
NSLog(@"Family %@", familyName);
NSLog(@"Names = %@", [UIFont fontNamesForFamilyName:familyName]);
@nomatteus
nomatteus / gist:4444799
Created January 3, 2013 16:43
get_distance_km function for postgres
CREATE FUNCTION get_distance_km(alat double precision, alon double precision, lat double precision, lon double precision) RETURNS double precision
LANGUAGE plpgsql
AS $$
DECLARE
radius_earth FLOAT;
radian_lat FLOAT;
radian_lon FLOAT;
distance_v FLOAT;
distance_h FLOAT;
distance FLOAT;
@nomatteus
nomatteus / gist:2776574
Created May 23, 2012 17:36
David Foster Wallace - Transcription of the 2005 Kenyon Commencement Address - May 21, 2005

David Foster Wallace - Transcription of the 2005 Kenyon Commencement Address - May 21, 2005

(If anybody feels like perspiring [cough], I'd advise you to go ahead, because I'm sure going to. In fact I'm gonna [mumbles while pulling up his gown and taking out a handkerchief from his pocket].) Greetings ["parents"?] and congratulations to Kenyon's graduating class of 2005. There are these two young fish swimming along and they happen to meet an older fish swimming the other way, who nods at them and says "Morning, boys. How's the water?" And the two young fish swim on for a bit, and then eventually one of them looks over at the other and goes "What the hell is water?"

This is a standard requirement of US commencement speeches, the deployment of didactic little parable-ish stories. The story ["thing"] turns out to be one of the better, less bullshitty conventions of the genre, but if you're worried that I plan to present myself here as the wise, older fish explaining what water is to you younger fish, please do

@nomatteus
nomatteus / format_html.py
Created October 17, 2011 16:00
Format HTML Using Python (Non-destructive, unlike HTML Tidy)
##
# This is a quick script that will format/indent HTML
# HTML Tidy is often too destructive, especially with bad HTML, so we're using Beautiful Soup
##
# USAGE: Designed to be used on the command line, just pipe HTML to it, and it will output
# cat file.html | python format_html.py
###
# Download & Install Beautiful Soup, if you don't have it already:
# Go to the Beautiful Soup web site, http://www.crummy.com/software/BeautifulSoup/
# Download the package
@nomatteus
nomatteus / .rvmrc
Created August 12, 2011 14:01
My .rvmrc file for rails
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.2-p290@pc-black-label"
#
# First we attempt to load the desired environment directly from the environment
@nomatteus
nomatteus / prettyTweetDateForTumblr.js
Created July 25, 2011 15:51 — forked from chrismendis/prettyTweetDateForTumblr.js
Change the dates returned by Tumblr's tweet.js callback to something like 12:00 PM Oct. 27th
var prettyTweetDate = function(tweetDateFromJSON) {
var tweetDate = new Date(Date.parse(tweetDateFromJSON)),
tweetHours = tweetDate.getHours();
tweetHours = (tweetHours < 13) ? tweetHours : tweetHours - 12;
var tweetDateSuffix = function(day) {
switch (day) {
case 1: case 21: case 31:
return "st"; break;
@nomatteus
nomatteus / gist:1093518
Created July 19, 2011 19:41
Really simple task (i.e. Rake) timing in Bash
# Just copy this line into your terminal
# Replace "clear ; rake" with whatever command(s) you want to time.
start=`date +'%s'` ; clear ; rake ; end=`date +'%s'`; echo \*\*\* Task took `expr $end - $start` seconds to run.
# Even better, add this to your ~/.bash_profile (or similar) file:
function timer() {
start=`date +'%s'`;
$@
end=`date +'%s'`;
echo \*\*\* Task took `expr $end - $start` seconds to run.;
@nomatteus
nomatteus / json.php
Created June 28, 2011 21:42
Sample using very basic XML feed file caching
<?php
/*
* File to convert NextBus' XML Feeds to JSON format
* that our script will use.
*/
// Get route from $_GET['r'] variable, or set to default
// TODO: Add in check for valid route
$route = (isset($_GET['r']) && (int) $_GET['r'] != 0) ? (int) $_GET['r'] : '501';