Skip to content

Instantly share code, notes, and snippets.

View danpalmer's full-sized avatar

Dan Palmer danpalmer

View GitHub Profile
@danpalmer
danpalmer / gist:4546950
Created January 16, 2013 12:55
I need to check that I'm not missing something about the details of CoreLocation. I am extending this code, and found this in the CLLocationManagerDelegate. It starts updating *location* and *heading*, then when it receives the *location* it stops updating the *heading* and vice-versa. This seems to be wrong to me, am I misunderstanding somethin…
- (void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
[manager stopUpdatingLocation];
occurrence.heading = [NSNumber numberWithDouble:[newHeading trueHeading]];
[occurrence didReceiveNewData];
}
- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
[manager stopUpdatingHeading];
occurrence.lat = [NSNumber numberWithDouble:newLocation.coordinate.latitude];
occurrence.lon = [NSNumber numberWithDouble:newLocation.coordinate.longitude];
<OpenSearchDescription
xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>GitHub</ShortName>
<Description>Search GitHub</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">
https://github.com/favicon.ico
21
</Image>
@danpalmer
danpalmer / gist:4524811
Created January 13, 2013 16:01
OpenSearch link tag for auto discovery.
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
#import "TestHelper.h"
static int
beforeAllRan
, beforeEachRan
, example1RanCorrectly
, example2RanCorrectly
, afterEachRan
, afterAllRan
;
@danpalmer
danpalmer / install
Last active December 10, 2015 09:28
$ heroku create --stack cedar --buildpack \
https://github.com/danpalmer/heroku-buildpack-hammer.git site-name
$ git push heroku master
...
-----> Downloading Nginx Sources
...
-----> Extracting Nginx Sources
-----> Configuring
...
#!/bin/sh
# bin/release <build-dir>
cat <<EOF
---
config_vars:
PATH: ${HOME}nginx/sbin:/usr/local/bin:/usr/bin:/bin
default_process_types:
web: ./boot.sh
EOF
worker_processes 1;
daemon off;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
set -e
BUILD_DIR=$1
CACHE_DIR=$2
BUILDPACK_DIR=`cd $(dirname $0); cd ..; pwd`
SUPPORT_DIR="$BUILDPACK_DIR/support"
#!/bin/sh
# bin/detect <build-dir>
# This buildpack is valid for use in project with a Build directory
if [ -d $1/Build ]; then
echo "Hammer Buildpack"
exit 0
else
exit 1
fi
<script type="text/javascript" src="/js/jquery.complexify.js"></script>
<script type="text/javascript">
$("#password").complexify({}, callback(valid, complexity){
alert("Password complexity: " + complexity);
});
</script>