Skip to content

Instantly share code, notes, and snippets.

View AphonicChaos's full-sized avatar

AphonicChaos AphonicChaos

View GitHub Profile
@AphonicChaos
AphonicChaos / GetBuildInfo.hs
Last active November 7, 2022 00:37
Build and release binaries for a Haskell app on Windows, MacOS X, and Linux (x86_64, sorry Apple Silicon)
#!/usr/bin/env -S runhaskell
{-# LANGUAGE CPP #-}
import Data.Char (toLower)
import Data.List (intercalate)
import Distribution.Package (packageVersion)
#if MIN_VERSION_Cabal(3, 8, 1)
import Distribution.Simple.PackageDescription (readGenericPackageDescription)
#else
import Distribution.PackageDescription.Parsec (readGenericPackageDescription)
@AphonicChaos
AphonicChaos / Counters.hs
Created June 27, 2020 23:53 — forked from mightybyte/Counters.hs
Reflex/React Comparison (look at the revision history)
{-# LANGUAGE OverloadedStrings #-}
import Reflex.Dom
counter = el "div" $ do
click <- button "Click"
clicks <- foldDyn (\() n -> n + 1) 0 click
el "p" $ display clicks
return clicks
main = mainWidget $ do
{-# LANGUAGE QuasiQuotes #-}
module Main where
import Text.Heredoc (here)
main = putStrLn [here|
.,ad88888888baa,
,d8P""" ""9888ba.
.a8" ,ad88888888888a
aP' ,88888888888888888a
<!DOCTYPE html>
<html>
<head>
<title>Micro Redux</title>
</head>
<body>
<button onclick="dispatch(DECREMENT)">-</button>
<span id="count"></span>
<button onclick="dispatch(INCREMENT)">+</button>
</body>
.modal-dialog.fancy {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) !important;
}

Sharing Django Users and Sessions Across Projects

By Dustin Farris on 22 Feb 2012

This document describes how to share users created using Django's auth system with other Django projects. It is not a hack; it simply makes use of the database router and middleware system that Django comes with out of the box.

Introduction

views for job and admin
/posting/order/
/posting/list/
posted job management
/posting/all/
purchased job management
/posting/purchased-jobs/
/posting/purchased-job/product/{purchased product id}/
{-# LANGUAGE OverloadedLists #-}
module Main where
import Data.Set
import Prelude hiding (null)
isDisjoint x = not . null . intersection x
require' xs ys cmp = cmp xs ys
require xs ys = require' xs ys isSubsetOf
@AphonicChaos
AphonicChaos / FSharp.hs
Last active March 14, 2016 16:16
What happens when I try to make Haskell look like F#
module FSharp where
import Text.Printf
import Prelude hiding ((.))
(%) :: Integral a => a -> a -> a
(%) = mod
(.) :: a -> (a -> b) -> b
x . f = f x
import React from 'react';
class StaticForm extends React.Component {
render() {
return (
<div class="container">
<form>
<label for="name">Name</label>
<input type="text" id="name"></input>
</form>