Skip to content

Instantly share code, notes, and snippets.

@dunhamsteve
dunhamsteve / scroller.js
Last active June 28, 2020 16:10
decorator for iPad scrollable areas
// This code is public domain, share and enjoy.
window.ui = window.ui || {};
/** @constructor */
ui.ListView = function(element, collection) {
this.el = element;
this.cellHeight = 30;
this.collection = collection;
@dunhamsteve
dunhamsteve / table.html
Last active May 21, 2024 22:06
Example of a scrollable table that only renders visible rows
<!-- This code is public domain, share and enjoy. -->
<html>
<style type="text/css" media="screen">
#table {
position: absolute;
top: 30px;
bottom: 0;
left: 10px;
right: 10px;
}
@dunhamsteve
dunhamsteve / wherefroms.py
Last active October 20, 2019 03:53
Code to get and set kMDItemWhereFroms in python
# This code is public domain, share and enjoy.
from Foundation import NSPropertyListSerialization
from xattr import setxattr, getxattr
kMDItemWhereFroms = "com.apple.metadata:kMDItemWhereFroms"
def set(path, *data):
"""Set kMDItemWhereFroms on a file. Pass in an array of strings."""
plist, err = NSPropertyListSerialization.dataWithPropertyList_format_options_error_(data, 200, 0, None)
if err or not plist: