Skip to content

Instantly share code, notes, and snippets.

View mcandre's full-sized avatar

Andrew mcandre

  • Milwaukee, WI
View GitHub Profile
Colour21\255,255,255\
Colour20\245,222,179\
Colour19\200,240,240\
Colour18\0,217,217\
Colour17\179,146,239\
Colour16\174,129,255\
Colour15\122,204,218\
Colour14\102,217,239\
Colour13\209,202,137\
Colour12\230,219,116\
@rvantonder
rvantonder / example.py
Created November 7, 2013 13:31
This sprung from wanting to know the difference between currying and partial function application in the functional programming paradigm. An example in Python.
# Consider the function f, with arity 3:
f = lambda x,y,z: x+y+z
# Let's curry f:
f_curried = lambda x: lambda y: lambda z: x+y+z
# f_curried has arity 1. When called with an argument, it will
# return another function (say, g) of arity 1 down the chain, e.g.:
g = f_curried(1)
@mzero
mzero / ghc-clang-wrapper
Created October 31, 2013 06:53
This wrapper script *should* enable GHC 7.* to work on systems with Xcode 5. To use it, drop this script somewhere, make it executable, and run.... Then follow the instructions it prints out. What it will do is, instruction you to put a copy in /usr/bin, then re-run it sudo. It will then find all your GHC 7 settings files, and patch them to make…
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
@jmoiron
jmoiron / valuer.go
Created October 14, 2013 18:03
Example uses of sql.Scanner and driver.Valuer
package main
import (
"bytes"
"compress/gzip"
"database/sql/driver"
"errors"
"fmt"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"

As you know, The first Witcher game was released for Mac on Steam a few days ago. It runs decently within a Wineskin wrapper, but it has been a polarizing issue for people who believed it should have been a native port rather than a "lazy" wrapped port.

In any case, I've been scouring the Internet for information on this game, and one particular post on the Inside Mac Games Forum stood out. Here is the link to the full post, but I've highlighted the important note here:

The Witcher: Mac Edition is using an older version of the Wineskin engine (WS8 1.3.7), so I swapped out the 1.3.7 engine with the very latest 1.5 engine and performance has improved SIGNIFICANTLY. I mean it.

I thought that was really interesting, so I searched around some more and found a few more links from other forums linking to the same post and asking how to do it. The poster actually went into some detail on the instructions, but assumes some pri

@pyrtsa
pyrtsa / gist:6213784
Created August 12, 2013 18:46
When installing Haskell Platform fails on Mac OS X (with quick fix below)

When installing Haskell Platform fails on Mac OS X (with quick fix below)

I was fighting with Haskell last weekend. At first, I couldn't install some missing libraries with Cabal, and then, when trying to find out what's wrong, I ended up removing the whole Haskell installation — only to find out I could no longer install neither the Haskell Platform nor even just Cabal Install! The warnings I would see were more or less about the use of the single quote in source code:

Preprocessing library text-0.11.2.3...

Data/Text.hs:6:52:
     warning: missing terminating ' character [-Winvalid-pp-token]

-- Copyright : (c) 2009, 2010, 2011, 2012 Bryan O'Sullivan,

@rofl0r
rofl0r / init.c
Created August 6, 2013 21:15
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
System Preferences -> Mission Control -> Mouse Button 4 -> -

Linux:

$ netstat | grep <port>

Mac OS X:

$ lsof -i :
@qbit
qbit / gist:5483415
Last active December 9, 2025 18:56
KSH support for git-prompt
# ksh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).