Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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.
<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">