Skip to content

Instantly share code, notes, and snippets.

@GabrielL
GabrielL / Makefile
Created November 25, 2010 10:35
llvm IR generation in C
CC = gcc
CXX = g++
CFLAGS = `llvm-config --cflags`
LDFLAGS = `llvm-config --libs --cflags --ldflags core analysis executionengine jit interpreter native`
# c++ compiler needed here for -lstdc++
fac:fac.o
$(CXX) $^ -o $@ $(LDFLAGS)
@tekacs
tekacs / show
Created April 20, 2011 17:55
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
@jsofra
jsofra / optional-config.clj
Created October 17, 2011 23:10
Config using optional named parameters
(def ^:dynamic *config* nil)
(defn save [data & {:keys [config] :or {config *config*}}]
(println (format "Saved %s with %s" data config)))
;; => (save {:a 5 :b 6} :config {:some :config})
;; Saved {:a 5, :b 6} with {:some :config}
;; nil
;; => (binding [*config* {:some :config}] (save {:a 5 :b 6}))
;; Saved {:a 5, :b 6} with {:some :config}
@pamelafox
pamelafox / twitter-bootstrap.scss
Created March 24, 2012 15:53
Bootstrap Android Overrides
body.android {
.modal {
@include box-shadow(none);
@include background-clip(border-box);
@include border-radius(0px);
border: 1px solid black;
}
.alert {
@include border-radius(0px);
text-shadow: none;
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@romannurik
romannurik / AndroidCreateGhostIcon.java
Created June 14, 2013 06:28
Android ColorMatrixColorFilter example: Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable). In the ghost bitmap, the RGB values take on the values from the 'color' argument, while the alpha values are derived from the source's grayscaled RGB values. The effect is that you can see through darker parts of the …
/**
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable).
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while
* the alpha values are derived from the source's grayscaled RGB values. The effect is that
* you can see through darker parts of the source bitmap, while lighter parts show up as
* the given color. The 'invert' argument inverts the computation of alpha values, and looks
* best when the given color is a dark.
*/
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) {
int width = src.getIntrinsicWidth();