This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent(object): | |
def __init__(self, x): | |
self.x = x | |
def frob(self): | |
self.x += 1 | |
class Child1(Parent): | |
def __init__(self, x, y): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS parent; | |
DROP TABLE IF EXISTS child; | |
CREATE TABLE parent( | |
identity_id integer, | |
valid_range int4range | |
); | |
CREATE TABLE child( | |
valid_range int4range, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, StandaloneDeriving, TypeOperators, ExistentialQuantification #-} | |
import Data.Type.Equality | |
data UTerm = UTrue | |
| UFalse | |
| UIf UTerm UTerm UTerm | |
| UZero | |
| USucc UTerm | |
| UIsZero UTerm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from haystack.signals import RealtimeSignalProcessor | |
from widgy.models.versioning import VersionCommit | |
class WidgyRealtimeSignalProcessor(RealtimeSignalProcessor): | |
def handle_commit(self, sender, instance, **kwargs): | |
for owner in instance.tracker.owners: | |
self.handle_save(sender=type(owner), instance=owner, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="post"> | |
{% csrf_token %} | |
{% if confirm %} | |
<div hidden> | |
{{ form.as_p }} | |
</div> | |
pls confirm | |
<input type=submit value="Confirm" name="confirm"> | |
{% else %} | |
{{ form.as_p }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmpd = do | |
tmp <- var $ glob "/tmp/tmp/" | |
today <- function $ cmd "date" ["+%F"] | |
when_ (not_ $ dirExists tmp) $ mkdir tmp | |
cd tmp | |
i <- var $ lit "1" | |
dir <- var $ today | |
while_ (dirExists dir) $ do | |
set i $ readVar i + 1 | |
set dir $ today <> lit "." <> readVar i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, ExistentialQuantification, TypeOperators, StandaloneDeriving #-} | |
import Data.Type.Equality | |
import Text.Read | |
data Renderer a b where | |
-- Lifts a normal function to a Renderer. The String is just a label | |
-- to see what's going on. | |
Lift :: String -> (a -> b) -> Renderer a b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, StandaloneDeriving, TypeOperators, ExistentialQuantification, EmptyCase #-} | |
import Data.Type.Equality | |
import Data.Void | |
data UTerm = UTrue | |
| UFalse | |
| UIf UTerm UTerm UTerm | |
| UZero | |
| USucc UTerm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Provides all the settings that are required to get COMPRESS_OFFLINE mode | |
working for django-compressor, just import everything from this file into your | |
settings and you will have turned on the offline compress mode. | |
If you wish to test it on your local setup, you can import it in your local | |
settings file. | |
# myproject/settings.py | |
from .settings_compress_offline import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE EmptyCase #-} | |
import Data.Void | |
import Control.Applicative | |
import Control.Monad.Trans | |
import Control.Monad | |
import Control.Monad.Writer | |
import System.IO | |
import qualified Data.ByteString as B |