Skip to content

Instantly share code, notes, and snippets.

@derekclee
derekclee / default.vcl
Last active June 11, 2024 19:51
Varnish Cache Set CORS headers
sub vcl_deliver {
if (req.url ~ "/fonts/") {
set resp.http.Access-Control-Allow-Origin = "*";
set resp.http.Access-Control-Allow-Methods = "GET, OPTIONS";
set resp.http.Access-Control-Allow-Headers = "Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token";
}
}
@addyosmani
addyosmani / README.md
Last active October 17, 2024 13:41 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@viktorklang
viktorklang / InterruptibleCancellableFuture.scala
Last active June 1, 2020 13:45
Interruptible-Cancellable-scala.concurrent.Future
/*
Copyright 2018 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@janih
janih / gist:4536956
Created January 15, 2013 07:37
A Java class to determine image width, height and color depth for a number of image file formats. Written by Marco Schmidt
/*
* ImageInfo.java
*
* Version 1.9
*
* A Java class to determine image width, height and color depth for
* a number of image file formats.
*
* Written by Marco Schmidt
*
package controllers
import play.api._
import play.api.mvc._
import org.apache.commons.httpclient.HttpClient
import org.apache.commons.httpclient.methods.GetMethod
import models.Purchase
object Paypal extends Controller {
@ct27stf
ct27stf / font-stacks.css
Created July 7, 2012 18:11
Similar looking fonts for Windows, Linux, Mac
.mono-font-stack {
font-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;
}
.times-font-stack {
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
}
.modern-font-stack {
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif," "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
@mackuba
mackuba / install.sh
Created April 26, 2012 15:46
Link all dotfiles from Dropbox
#!/bin/bash
for filename in `ls /Users/psionides/Dropbox/dotfiles`; do
name=`basename $filename .txt`
echo "Linking /Users/psionides/Dropbox/dotfiles/$filename to /Users/psionides/.$name..."
rm -f /Users/psionides/.$name
ln -s /Users/psionides/Dropbox/dotfiles/$filename /Users/psionides/.$name
done
echo "Done."
@dph01
dph01 / gist:2049865
Created March 16, 2012 12:26
media streaming
def serve(reqdFile: String): Box[LiftResponse] = {
debug("request headers: " + S.request.map(_.headers.map(h => h._1 + "\t\t" + h._2 + "\n").toString).openOr(""))
User.currentUser match {
case Full(user) => {
try {
debug("starting in Media Server for logical file: " + reqdFile + ".....")
// e.g. turn 1092345.mp4 into (1092345,mp4)
@mxcl
mxcl / uninstall_homebrew.sh
Created August 26, 2011 11:25
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@lxneng
lxneng / gist:741932
Created December 15, 2010 13:21
install PostgreSQL 9 in Mac OSX via Homebrew
install PostgreSQL 9 in Mac OSX via Homebrew
Mac OS X Snow Leopard
System Version: Mac OS X 10.6.5
Kernel Version: Darwin 10.5.0
Install notes for PostgreSQL 9.0.1 install using Homebrew:
sh-3.2# brew install postgresql