Skip to content

Instantly share code, notes, and snippets.

@rknLA
rknLA / firm_forces.py
Last active October 12, 2015 21:28
the first 10 sorted forces with 3D Touch set to "Firm"
sorted_firm_forces = [0.0,
0.0138888883369941,
0.0555555533479762,
0.0694444416849703,
0.166666660043929,
0.263888878402887,
0.277777766739881,
0.291666655076875,
0.305555543413869,
0.319444431750863]
@rknLA
rknLA / a_few_light_forces.py
Last active October 12, 2015 21:30
first 10 sorted forces with 3D Touch sensitivity set to "Light"
first_ten_forces = [0.0,
0.0208333330228925,
0.041666666045785,
0.0624999990686774,
0.0833333320915699,
0.104166665114462,
0.124999998137355,
0.145833331160247,
0.16666666418314,
0.187499997206032]
questionable_strides = { \
val: int(round(indexed_distances[val] * 60 * 100)) / 100.0 \
for val in questionable_indices }
questionable_indices = [ ix \
for ix, val in indexed_distances.iteritems() \
if int(round(val * 60)) != 1 ]
distances = []
i = 0
while i < len(sorted_forces) — 2:
this_val = sorted_forces[i]
next_val = sorted_forces[i+1]
# ^^ this is why we use -2 instead of -1 in the while condition
distance = next_val — this_val
distances.append(distance)
i += 1
var possibleForceValues: Set<CGFloat> = []
func touchUpdatedHandler(touch: UITouch) {
let preInsertionLength = possibleForceValues.count
possibleForceValues.insert(touch.force)
let postInsertionLength = possibleForceValues.count
if postInsertionLength - preInsertionLength == 1 {
print("inserted unique force: \(touch.force)")
}
}
import re
matcher = re.compile('^inserted unique force: (\d*\.\d*)$')
with open('pasted_log_file.txt', 'r') as lf:
lines = lf.readlines()
forces = set()
for line in lines:
match = matcher.search(line)
if match:
groups = match.groups()
force = groups[0]
@rknLA
rknLA / sorted_force_values.py
Last active October 11, 2015 20:38
Dataset of unique 3D Touch values used in exploring its behavior
# Released as CC0 - do what you wish with these, they're just numbers.
sorted_force_values = [0.0,
0.0166666666666667,
0.0333333333333333,
0.05,
0.0666666666666667,
0.0833333333333333,
0.1,
0.116666666666667,
0.133333333333333,
@rknLA
rknLA / gist:0f9439305f487cf705a0
Created October 2, 2015 14:41
touch pressure logs
touches began:
[<UITouch: 0x1375295e0> phase: Began tap count: 1 window: <UIWindow: 0x1376422c0; frame = (0 0; 667 375); autoresize = W+H; gestureRecognizers = <NSArray: 0x13762fe90>; layer = <UIWindowLayer: 0x1376422a0>> view: <TouchCanvas.CanvasView: 0x1375544d0; frame = (0 0; 667 375); autoresize = W+H; layer = <CALayer: 0x137554ef0>> location in window: {507.5, 172} previous location in window: {507.5, 172} location in view: {507.5, 172} previous location in view: {507.5, 172}]
touch pressure: 0.366666666666667
touch pressure: 0.95
touch pressure: 1.73333333333333
FROM private/docker/host/postgres-flask-uwsgi-nginx
MAINTAINER Kevin Nelson "kevin@rkn.la"
# Set up nginx by removing the default site, and adding ours
#RUN rm /etc/nginx/sites-enabled/default
RUN ln -s $APP_DIR/deploy/nginx.conf /etc/nginx/conf.d/
# create log folders
RUN mkdir -p /var/log/uwsgi