Skip to content

Instantly share code, notes, and snippets.

View Kha's full-sized avatar

Sebastian Ullrich Kha

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<body>
<h1>Offene Bestellungen</h1>
<ReportDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
ColumnWidth="400" FontSize="14" FontFamily="Georgia"
xmlns:c="clr-namespace:AptusSolutions.Reporting;assembly=AptusSolutions.Reporting">
<ReportDocument.PageHeader>
<Paragraph>
Page Header
</Paragraph>
</ReportDocument.PageHeader>
<ReportDocument.ReportHeader>
<Paragraph>
class Category
{
// wiee, kein notify-Keyword :( ?
public string Header { get; set; }
public string Id { get; set; }
// two-way bound
public bool IsExpanded { get; set; }
public bool IsSelected { get; set; }
public ObservableCollection<Category> SubCategories { get; private set; }
public static Expression<Func<T,V>> Bind<T, U, V>(Expression<Func<T, U>> f1, Expression<Func<U, V>> f2)
{
var param = Ex.Parameter(typeof(T), "hi");
return Ex.Lambda<Func<T, V>>(
Ex.Invoke(f2,
Ex.Invoke(f1, param)),
param);
}
[<Struct>]
type Point (x : int, y: int) =
new (i : int) = Point (i,i)
member p.X = x
member p.Y = y
static member (+) (p : Point, q : Point) = Point (p.X + q.X, p.Y + q.Y)
static member (-) (p : Point, q : Point) = Point (p.X - q.X, p.Y - q.Y)
static member (|Point|) (p : Point) = p.X,p.Y
static member DistanceSqr (p : Point) (q : Point) = sqr (p.X - q.X) + sqr (p.Y - q.Y)
type LinearFunc = { M : float; B : float }
type Point = { X : float; Y : float }
let sqr x = x * x
let frac x = x - floor x
let calc f x = { X = x; Y = f.M * x + f.B }
let plusMinus delta dx = { -delta..dx..delta }
int dist(string a, string b) {
int n = a.length(), m = b.length();
vector<int> row(m+1), prev(m+1);
// y == 0
for (int x = 0; x <= m; x++) row[x] = x;
for (int y = 1; y <= n; y++) {
swap(prev, row);
@Kha
Kha / rc.part.lua
Created October 30, 2011 22:00
Mod+Ctrl+o: Move all clients of active tags to next screen
globalkeys =
...
-- Move all clients of active tags to next screen
awful.key({ modkey, "Control" }, "o",
function ()
for i,t in ipairs(screen[mouse.screen]:tags()) do
if t.selected then
for j,c in ipairs(t:clients()) do
awful.client.movetoscreen(c)
@Kha
Kha / post-commit
Created November 18, 2011 20:13
Send git commit message to Pidgin chat room
#! /usr/bin/python2.7
# copy into .git/hooks
# dependencies: python2 dbus-python
import subprocess, dbus
room = "blub@conference.jabber.ccc.de"
bus = dbus.SessionBus()
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
Input-, Output-Klassen, Buffer-Properties:
Node.cs:
public class Output {
public Node Node;
public int Index;
public Frame Buffer;
}
public class Input {
public Input Source;
public Frame Buffer;