Skip to content

Instantly share code, notes, and snippets.

Building a Web App with Cloudflare Workers, D1, and Rust**

Chapter 1: Integrating Cloudflare D1 with Workers

  1. Introduction to D1
    D1 is Cloudflare’s SQLite-compatible database that is perfect for serverless environments like Cloudflare Workers. It brings SQL to the edge, enabling performant and durable queries.

  2. Setting Up D1 in Your Project
    Explain how to set up D1 by creating a new Cloudflare project and connecting D1. You can follow this process:

@mattdenner
mattdenner / README.markdown
Last active July 30, 2025 07:25
Suspend and then hibernate after 60 minutes

I found a post about suspending and then going into hibernate that included a really clever script. Turns out that with NixOS this is even esaier to coordinate as you have systemd so can have a before and after service. I just include this in my /etc/nixos/configuration.nix file and nixos-rebuild; then a systemctl suspend or a close of the lid will cause the hibernate timer to be set.

@rmoch
rmoch / gist:6364899
Last active April 22, 2016 17:47
- Django form widget for bootstrap switch HTML widget - http://www.bootstrap-switch.org/ - https://github.com/nostalgiaz/bootstrap-switch
class CheckBoxBootstrapSwitch(CheckboxInput):
"""Django widget for bootstrap switch HTML widget: http://www.bootstrap-switch.org/
Options can be provided through 'switch' argument:
switch = forms.BooleanField(required=False, label=_(u"bootstrap switch"),
widget=CheckBoxBootstrapSwitch(switch={'size': 'small', 'on': 'warning', 'text-label': 'Switch Me'}))
"""
def __init__(self, switch=None, *args, **kwargs):
self.switch = switch or {}
super(CheckBoxBootstrapSwitch, self).__init__(*args, **kwargs)