Skip to content

Instantly share code, notes, and snippets.

use std::env;
use std::time::Duration;
use postgres::tls::openssl::OpenSsl;
use r2d2::{self, PooledConnection};
use r2d2_postgres::{TlsMode, PostgresConnectionManager};
use rocket::Request;
use rocket::request::{Outcome, FromRequest};
use rocket::Outcome::{Success, Failure};
use rocket::http::Status;

How Do I Into Git?

a helpful primer for users sick of git's poorly-named commands

I've used Git since 2011, and this is the stuff that I've always had to Google to remember. I hope it helps you not hate Git so much.

Learning About the Repo

Learning About History

@Spindel
Spindel / watchdog.md
Last active May 24, 2023 09:48
Showing off the systemd watchdog in Python

Watchdogged

Place the service file (or a link to it) in /etc/systemd/system/ Place the watchdogged.py file somewhere ( and change the ExecStart portion in the .service to point at the file )

then do systemctl daemon-reload followed by systemctl start watchdogged.service

After this you can watch the progress using journalctl --follow -u watchdogged.service change the PROBABILITY variable to something else to watch it faster/later or succeed.

@bensu
bensu / Dropdown.elm
Created August 19, 2015 19:52
Dropdown Component in Elm
module Dropdown where
import List exposing (..)
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick, onBlur)
-- MODEL
@dela3499
dela3499 / KeyboardLayouts.elm
Last active March 8, 2016 07:22
Compare keyboard layouts to where your keystrokes go. http://share-elm.com/gists/1b632e6607a179b20dbd
import Graphics.Input.Field as Field exposing
(Content, noContent, field, defaultStyle, Direction)
import Graphics.Collage exposing (..)
import Maybe exposing (withDefault)
import Dict exposing (Dict)
import Graphics.Element as Elem exposing (..)
import Signal
import Color exposing (..)
import String
import Window
import Graphics.Element exposing (show)
import Signal exposing (Address)
import Html exposing (Html, div, span, text, input)
import Html.Events exposing (on, targetValue)
import Html.Attributes exposing (value, style)
import Maybe
import StartApp
---------------------------
main =
-- inspired by: https://groups.google.com/d/msg/elm-discuss/2LxEUVe0UBo/ZgJ_ldUH6ygJ
-- thanks for the help: http://learnyouahaskell.com/functors-applicative-functors-and-monoids
module UserDecoder where
import Date exposing (Date)
import User exposing (User)
import Json.Decode as Js exposing ((:=))
-- Applicative's `pure`:
@mgold
mgold / using_mailboxes_in_elm.md
Last active March 24, 2020 16:05
Using Mailboxes in Elm: a tutorial blog post

Using Mailboxes in Elm

Max Goldstein | July 30, 2015 | Elm 0.15.1

In Elm, signals always have a data source associated with them. Window.dimensions is exactly what you think it is, and you can't send your own events on it. You can derive your own signals from these primitives using map, filter, and merge, but the timing of events is beyond your control.

This becomes a problem when you try to add UI elements. We want to be able to add checkboxes and dropdown menus, and to receive the current state of these elements as a signal. So how do we do that?

The Bad Old Days

@TheSeamau5
TheSeamau5 / multipageform.elm
Last active October 30, 2020 16:54
Simple multi-page form
import Html exposing (Html, Attribute)
import Html.Attributes
import Html.Events
import Signal exposing (Address)
import List
import String
import StartApp
------------------
--- HELPER CODE --
@TheSeamau5
TheSeamau5 / HackerNewsExample.elm
Last active September 23, 2018 00:24
Hacker news requests example
--------------------------
-- CORE LIBRARY IMPORTS --
--------------------------
import Task exposing (Task, ThreadID, andThen, sequence, succeed, spawn)
import Json.Decode exposing (Decoder, list, int, string, (:=), map, object2)
import Signal exposing (Signal, Mailbox, mailbox, send)
import List
---------------------------------
-- THIRD PARTY LIBRARY IMPORTS --