Skip to content

Instantly share code, notes, and snippets.

View pcapriotti's full-sized avatar

Paolo Capriotti pcapriotti

View GitHub Profile
Index: ruby/qtruby/src/handlers.cpp
===================================================================
--- ruby/qtruby/src/handlers.cpp (revision 1148646)
+++ ruby/qtruby/src/handlers.cpp (working copy)
@@ -333,6 +333,14 @@
if (item->parentItem() == 0) {
mark_qgraphicsitem_children(item);
}
+ if (QGraphicsEffect* effect = item->graphicsEffect()) {
+ obj = getPointerObject(effect);
def on(sig, types = nil, &blk)
sig = Signal.create(sig, types)
candidates = if is_a? Qt::Object
signal_map[sig.symbol]
end
if candidates
if types
# find candidate with the correct argument types
candidates = candidates.find_all{|s| s[1] == types }
end
From ba220db019793794ed068a4c1441eecee330ea65 Mon Sep 17 00:00:00 2001
From: Paolo Capriotti <[email protected]>
Date: Wed, 27 Oct 2010 18:32:26 +0100
Subject: [PATCH] Simplify function regexp and fix bug for pointer and reference return types.
---
vim-protodef/pullproto.pl | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/vim-protodef/pullproto.pl b/vim-protodef/pullproto.pl
@pcapriotti
pcapriotti / reactor.py
Created July 16, 2011 08:54
Reactor Framework
"""The reactor framework.
This module introduces the *reactor framework*, a collection of utilities to be
used in conjunction with the greelet library to solve the problem of inversion
of control in event-driven code.
Traditionally, writing event-driven code typically consists of "connecting"
signals to handlers (i.e. callbacks), which are to be invoked by the framework
in use when a certain "event" occurs.
@pcapriotti
pcapriotti / gist:1761136
Created February 7, 2012 18:30
Composition of free monads
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
import Control.Monad
import Control.Monad.Free
class (Functor f, Functor g, Functor h) => Compose f g h | f g -> h where
compose :: f x -> g y -> Free h (Free f x, Free g y)
compose f g = return (liftF f, liftF g)
composeF :: Compose f g h => Free f x -> Free g x -> Free h x
@pcapriotti
pcapriotti / http.hs
Created February 12, 2012 15:12
Sketch of http server implementation based on pipes
import Control.Monad
import Control.Pipe
import Control.Pipe.ChunkPipe
import Control.Pipe.Monoidal
import Data.ByteString (ByteString, empty)
import Data.List
import Data.Void
import Network.Socket
type Input = Either RequestH ByteString
@pcapriotti
pcapriotti / exists.c
Created June 7, 2012 15:35
CreateFile example
#include <windows.h>
#include <stdio.h>
int main()
{
HANDLE h = CreateFile(
"bar.txt",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
@pcapriotti
pcapriotti / pipes.hs
Created June 8, 2012 16:24
Another Pipe experiment
{-# LANGUAGE CPP, GADTs, KindSignatures, TypeFamilies, DataKinds #-}
import Control.Monad
type family If (t :: Bool) a b
type instance If True a b = a
type instance If False a b = b
data Pipe a b (t :: Bool) m r where
Pure :: r -> Pipe a b t m r
@pcapriotti
pcapriotti / git-branch-status.sh
Created July 31, 2012 14:54
summary of branches
#!/bin/bash
# based on https://gist.github.com/1288596
RED="\033[0;31m"
YELLOW="\033[0;33m"
GREEN="\033[0;32m"
NOCOLOR="\033[00m"
BOLD="\033[1;37m"
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
while read local remote
module m where
open import sum
open import equality
open import function
open import sets.nat
open import sets.unit
open import hott.level.core
module _ (A : Set)(B : A → Set) where