Skip to content

Instantly share code, notes, and snippets.

<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<polymer-element name="my-element">
@keithio
keithio / post.js
Last active August 29, 2015 14:00
Parse.Object.previous() workaround for Parse.Cloud.beforeSave()
Parse.Cloud.beforeSave('Post', function (request, respond) {
var post = request.object;
var prevCatId = post.get('prevCat').id;
var catId = post.get('cat').id;
if (post.dirty('cat')) {
var prev = new Parse.Query('Category');
prev.get(prevCatId, {
success: function (category) {
// Decrement old category post count.
@keithio
keithio / index.html
Created February 6, 2014 21:51
Usage for angular-mailchimp.js
<form name="MailchimpSubscriptionForm" ng-controller="MailchimpSubscriptionCtrl">
<div ng-hide="mailchimp.result === 'success'">
<input class="hidden" type="hidden" ng-model="mailchimp.username" ng-init="mailchimp.username='username'">
<input class="hidden" type="hidden" ng-model="mailchimp.dc" ng-init="mailchimp.dc='us1'">
<input class="hidden" type="hidden" ng-model="mailchimp.u" ng-init="mailchimp.u='a1b2c3d4e5f6g7h8i9j0'">
<input class="hidden" type="hidden" ng-model="mailchimp.id" ng-init="mailchimp.id='aabb12'">
<input type="text" name="fname" ng-model="mailchimp.fname" placeholder="First name">
<input type="text" name="lname" ng-model="mailchimp.lname" placeholder="Last name">
<input type="email" name="email" ng-model="mailchimp.email" placeholder="Email address" required>
<button ng-disabled="MailchimpSubscriptionForm.$invalid" ng-click="addSubscription(mailchimp)">Join</button>
@keithio
keithio / deletes3bucket.py
Created October 21, 2011 00:58
Recursively delete everything on an S3 bucket
'''
Copyright (c) 2011, Keith Hall <http://keith.io>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
@keithio
keithio / Compile and install netatalk
Created August 24, 2011 00:55
Compile and install netatalk
$ sudo aptitude update
$ mkdir netatalk
$ cd netatalk
$ sudo aptitude install libcrack2-dev libssl-dev
$ apt-get source netatalk
$ sudo apt-get build-dep netatalk
$ cd netatalk-2.1.4
$ sudo DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -us -uc
$ sudo debi
$ echo "netatalk hold" | sudo dpkg --set-selections
@keithio
keithio / ispell for latex
Created August 21, 2011 06:21
ispell for latex
$ ispell -t document.tex
@keithio
keithio / Install Ubuntu Tweak
Created August 21, 2011 06:16
Install Ubuntu Tweak
$ sudo add-apt-repository ppa:tualatrix/ppa
$ sudo aptitude update
$ sudo aptitude install ubuntu-tweak
@keithio
keithio / Alps Touchpad Fix
Created August 21, 2011 06:14
Alps Touchpad Fix
echo "options psmouse proto=imps" | sudo tee -a /etc/modprobe.d/psmouse.conf
sudo modprobe -r psmouse
sudo modprobe psmouse
@keithio
keithio / listdircontents.py
Created August 21, 2011 03:16
Traverse a directory structure and print contents with indentation
'''
Copyright (c) 2011, Keith Hall <http://keith.io>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF U
#load-module module-alsa-sink
load-module module-alsa-sink device=hw:1,7