This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remember to change framework search paths for cedar specs to $(SRCROOT)/Specs/Frameworks to work on CI (i.e. travis) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface MyTextView : UITextView | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in a tap gesture recognizer handler in view controller | |
// assuming you have a text view in controller called "myTextView" | |
- (void)myTextViewTapped:(UITapGestureRecognizer *)recognizer { | |
// get tap location in view in question | |
CGPoint location = [recognizer locationInView:self.myTextView]; | |
// adjust location for text view's offsets | |
location.x -= self.myTextView.textContainerInset.left; | |
location.y -= self.myTextView.textContainerInset.top; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am boundsj on github. | |
* I am boundsj (https://keybase.io/boundsj) on keybase. | |
* I have a public key whose fingerprint is 8C6A AF5D 5922 5BF4 45A2 1278 54F0 7E43 1D15 92FF | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
THE PROBLEM: | |
Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.) | |
THE TEMPTINGLY EASY BUT TOTALLY WRONG SOLUTION: | |
Alter the port the script talks to from 8000 to 80: | |
}).listen(80); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
# jesse's .profile | |
################################################################ | |
# set path so that the bin folder that brew uses comes before | |
# the /usr/bin | |
PATH=/usr/local/bin:$PATH | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# path taken from brew install notes | |
POSTGIS_SQL_PATH=/usr/local/share/postgis | |
# Creating the template spatial database. | |
createdb -E UTF8 template_postgis | |
createlang -d template_postgis plpgsql # Adding PLPGSQL language support. | |
# Allows non-superusers the ability to create from this template | |
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import pymongo | |
from pymongo import Connection | |
earth_radius_in_miles = 3959.0 | |
radians_to_degrees = 180.0 / math.pi | |
radius = (0.0189393939 / earth_radius_in_miles) * radians_to_degrees # 100 foot radius | |
bbox_earth_radius = 3959.0 # miles | |
bbox_dist_from_center = 0.1 # miles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from math import sqrt | |
def vector_length(vector): | |
""" | |
Compute length (aka magnitude, Euclidiean norm) of vector. | |
This gives the ordinary distance from the origin to the point x, | |
a consequence of the Pythagorean theorem. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user1 = require('./user.js'), | |
user2 = require('./user.js'), | |
assert = require('assert'); | |
// initialize the value in user1 | |
user1.name("test"); | |
// set it to another value in user2 | |
user2.name("ohai"); | |
// user1's value has been changed | |
assert.equal(user1.name(), "ohai", "oops"); |
OlderNewer