Skip to content

Instantly share code, notes, and snippets.

View aggieben's full-sized avatar
🏠
Working from home

Ben Collins aggieben

🏠
Working from home
View GitHub Profile
;;;;
;;;; a flash widget that fades out dynamically without another HTTP request
;;;;
(proclaim '(optimize (debug 3)))
(in-package :lisp-blog)
(export '(fading-flash fading-flash-messages fading-flash-message))
(defwidget fading-flash (flash)
((delay :accessor fading-flash-delay
(defclass cons-presentation-mixin ()
((car-type :accessor cons-presentation-car-type
:initarg :car-type)
(cdr-type :accessor cons-presentation-cdr-type
:initarg :cdr-type))
(:documentation "A presentation for conses."))
(defclass cons-presentation (presentation cons-presentation-mixin)
()
)
#include <istream>
#include <stdexcept>
#include <string>
#include <sstream>
#include "text_config.hpp"
namespace {
std::string get_section_name(std::string& line)
{
#include <istream>
#include <map>
#include <string>
#include <sstream>
class text_config
: public std::map<std::string, std::map<std::string, std::string> >
{
public:
friend std::istream& operator>>(std::istream&, text_config&);
(defpackage :slimtimer
(:use :cl)
(:export :with-xml :start-session :list-tasks :list-entries))
(in-package :slimtimer)
(require 'drakma)
(require 's-xml)
(require 'babel)
(require 'cl-who)
(in-package :slimtimer)
(export '(time-entry-task task-name task-hours task-last))
(require :s-xml)
(defmacro with-xml (&body body)
`(with-output-to-string (ss)
(format ss "<?xml version=1.0\" encoding=\"utf-8\"?>")
(cl-who:with-html-output (ss)
,@body)))
type FieldValue<'a when 'a : (static member Parse: string -> 'a)>(arg:string) =
let value = 'a.Parse(arg)
member m.Value = value
> type Test<'a when 'a: (static member Parse: string -> 'a)>(arg:string) = let value = arg;;
type Test< ^a when ^a : (static member Parse : string -> ^a)> =
class
new : arg:string -> Test< ^a>
end
// reflected as:
[Serializable, CompilationMapping(SourceConstructFlags.ObjectType)]
class Base
{
Base()
{
PostChildConstructorEvent += (() => /* do something after Thing is done initializing */);
}
}
class Thing : Base
{
#light
#r @"C:\Users\Ben\Development\.NET\FParsec\Build\Release\FParsecCS.dll"
#r @"C:\Users\Ben\Development\.NET\FParsec\Build\Release\FParsec.dll"
open FParsec.Primitives
open FParsec.CharParsers
let s0 = @"~01001~^~0100~^~Butter, salted~^~BUTTER,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87"
let s1 = "~01001~^~0100~^~Butter, salted~^~BUTTER,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87