Skip to content

Instantly share code, notes, and snippets.

@cassus
cassus / Dev platform settings
Created Nov 1, 2016
Zapier app to read Activity and Sleep data from FitBit
View Dev platform settings
## Triggers (Bringing data into Zapier)
### Sleep - polling
https://api.fitbit.com/1/user/-/sleep/date/today.json
### Activity - polling
https://api.fitbit.com/1/user/-/activities/list.json?beforeDate=today&sort=desc&limit=10&offset=0
## Scripting API
see script.js
@cassus
cassus / Delay.js
Created Oct 25, 2014
Delay component for Facebook React
View Delay.js
/** @jsx React.DOM */
module React from 'react'
var Delay = React.createClass({
propTypes: {
by: React.PropTypes.number.isRequired,
},
getInitialState() {
@cassus
cassus / DisplayModal.js
Created Aug 10, 2014
Open a react-bootstrap.Modal from a react-router Route
View DisplayModal.js
/** @jsx React.DOM */
/** @type React */
module React from 'react'
var RB = require('react-bootstrap')
module Router from 'react-router'
var DisplayModal = React.createClass({
mixins: [RB.OverlayMixin],
@cassus
cassus / admin.py
Last active Aug 29, 2015
Action button on django model edit page
View admin.py
class MyAdmin(admin.ModelAdmin):
def response_change(self, request, obj):
if "_activate_and_send_email" in request.POST:
self.activate_account_and_send_email(request, (obj,))
return HttpResponseRedirect(request.path)
return super().response_change(request, obj)
@cassus
cassus / admin.py
Last active Jun 17, 2019
Django admin action as row button
View admin.py
class MyAdmin(admin.ModelAdmin):
list_display = (..., 'actions_html')
def actions_html(self, obj):
return format_html('<button class="btn" type="button" onclick="activate_and_send_email({pk})">Activate and send email</button>', pk=obj.pk)
actions_html.allow_tags = True
actions_html.short_description = "Actions"
@cassus
cassus / load_history_to_sonar.py
Created Aug 14, 2013
Load repo history to sonar
View load_history_to_sonar.py
#!/usr/bin/env python
from datetime import datetime
import os
import sys
from dateutil.relativedelta import relativedelta
import sh
def checkout_repo_at(path, dt):