Skip to content

Instantly share code, notes, and snippets.

View liesen's full-sized avatar

liesen

  • I'm just exploring, really
  • Stockholm, Sweden
View GitHub Profile
#import <Cocoa/Cocoa.h>
#import <AppKit/NSAccessibility.h>
static CFStringRef kSpotlightBundleIdentifier = CFSTR("com.apple.spotlight");
static void SpotlightCallback(AXObserverRef observer,
AXUIElementRef element,
CFStringRef notification,
#import <Cocoa/Cocoa.h>
#import <AppKit/NSAccessibility.h>
static CFStringRef kSpotlightBundleIdentifier = CFSTR("com.apple.spotlight");
static void SpotlightCallback(AXObserverRef observer,
AXUIElementRef element,
CFStringRef notification,
/* Cocoa accessibility framework for intercepting Spotlight user input. */
#import <Cocoa/Cocoa.h>
#import <AppKit/NSAccessibility.h>
static void searchFieldCallback(AXObserverRef observer,
AXUIElementRef element,
CFStringRef notification,
void *data) {
CFTypeRef subrole, value;
// Bush in Scala
package tests
object Bush {
def main(args : Array[String]) : Unit = {
val states = "Alabama\nAlaska\nArizona\nArkansas\nCalifornia\nColorado\nConnecticut\nDelaware\nFlorida\nGeorgia\nHawaii\nIdaho\nIllinois\nIndiana\nIowa\nKansas\nKentucky\nLouisiana\nMaine\nMaryland\nMassachusetts\nMichigan\nMinnesota\nMississippi\nMissouri\nMontana\nNebraska\nNevada\nNew Hampshire\nNew Jersey\nNew Mexico\nNew York\nNorth Carolina\nNorth Dakota\nOhio\nOklahoma\nOregon\nPennsylvania\nRhode Island\nSouth Carolina\nSouth Dakota\nTennessee\nTexas\nUtah\nVermont\nVirginia\nWashington\nWest Virginia\nWisconsin\nWyoming".lines
val georgewbush = Set.empty ++ "georgewbush"
printf("It's sweet home %s!%n", (states find { state => !(state.toLowerCase exists { georgewbush contains _ }) }).get)
}
// http://stackoverflow.com/questions/1376077/code-golf-the-wave
object Wave {
def main(args: Array[String]) {
val s = if (!args.isEmpty) args(0) else "31415926535897932384626433832795028841971693993751058209749445923078164062862"
val (ls, _) = ((Map() + 0 -> s.substring(0, 1), 0) /: s.toList.zipWithIndex.tail) {
case ((ls, y), (c, i)) =>
val d = y + (c compare s(i - 1))
((ls + d -> (ls.getOrElse(d, "") match { case z => z + (" " * (i - z.length)) + c })), d)
}
#import <Cocoa/Cocoa.h>
#import <AppKit/NSAccessibility.h>
static CFStringRef kSpotlightBundleIdentifier = CFSTR("com.apple.systemuiserver");
static void SpotlightCallback(AXObserverRef observer,
AXUIElementRef element,
CFStringRef notification,
@liesen
liesen / node-spotify-external.js
Created July 13, 2010 18:10
draft of a js api for libspotify
/**
* @namespace
*/
spotify = {};
/**
* @enum {number}
*/
spotify.Error = {
body {
background-color: #000 !important;
}
#statusBar {
background-color: #224 !important;
border-color: #336 !important;
}
#buffers li.server {
@liesen
liesen / patch1.patch
Created November 8, 2010 17:22
CGAL bugs: Sweep line algorithm does not respect the report_endpoints argument
--- CGAL/Sweep_line_2/Sweep_line_2_visitors.h 2010-11-08 18:45:53.000000000 +0100
+++ /Users/liesen/crap/Sweep_line_2_visitors.h 2010-11-08 18:45:45.000000000 +0100
@@ -99,9 +99,7 @@
Status_line_iterator /* iter */,
bool /* flag */)
{
- if ((m_includeEndPoints ||
- event->is_intersection() ||
- event->is_weak_intersection()) && event->is_closed())
+ if ((event->is_intersection() || (event->is_weak_intersection() && m_includeEndPoints)) && event->is_closed())
@liesen
liesen / test2.cpp
Created November 8, 2010 17:25
CGAL bugs: Sweep line algorithm does not report intersection, x, between two segments if another segment has an end point equal to x
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Sweep_line_2_algorithms.h>
#include <list>
#include <set>
typedef CGAL::Gmpq NT;
typedef CGAL::Simple_cartesian<NT> Kernel;