Skip to content

Instantly share code, notes, and snippets.

View DylanLukes's full-sized avatar

Dylan Lukes DylanLukes

View GitHub Profile
trait AgentLogging extends Logging { self: App =>
def adaptHandler(h: SLF4JBridgeHandler): Handler = {
return new Handler(formatter = BareFormatter, level = None) {
override def flush() = h.flush()
override def publish(record: LogRecord) = h.publish(record)
override def close() = h.close()
}
import React from 'react';
import AppBar from 'material-ui/lib/app-bar';
import RaisedButton from 'material-ui/lib/raised-button';
import getMuiTheme from 'material-ui/lib/styles/getMuiTheme';
import MyTheme from '../theme';
import LeftNav from 'material-ui/lib/left-nav';
import Divider from 'material-ui/lib/divider';
import IconButton from 'material-ui/lib/icon-button';
def lex(line):
"""
Consumes a line and yields tokens for numbers and relevant
symbols and words.
"""
for s in re.split('[^a-zA-Z0-9_%$/.]+', line):
# Skip empty strings. We don't need them.
if not s:
continue
#!/bin/bash
function atoi {
IP=$1; IPNUM=0
for (( i=0 ; i<4 ; ++i )); do
((IPNUM+=${IP%%.*}*$((256**$((3-${i}))))))
IP=${IP#*.}
done
echo $IPNUM
}
@DylanLukes
DylanLukes / Types.hs
Last active August 29, 2015 14:22
Types.hs
{-# LANGUAGE Arrows #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Haven.Types where
data TicketId' a = TicketId a deriving (Functor)
type TicketId = TicketId' Int
type TicketIdColumn = TicketId' (Column PGInt4)
$(makeAdaptorAndInstance "pTicketId" ''TicketId')
data Ticket' a b c d e = Ticket { _tId :: a
, _tTicket :: b
, _tUserId :: c
, _tExpires :: d
, _tConsumed :: e }
from django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_page_extension(context):
return context['current_page'].epicpageextension
@register.assignment_tag(takes_context=True)
def get_title_extension(context):
noflo = require 'noflo'
browserify = require 'browserify'
evil = require 'notevil'
class Bundler extends noflo.Component
icon: 'gift'
description: 'Bundles input files using Browserify'
constructor: ->
@inPorts = new noflo.InPorts
bundle: