Skip to content

Instantly share code, notes, and snippets.

View pbroschwitz's full-sized avatar

Peter Broschwitz pbroschwitz

View GitHub Profile
@pbroschwitz
pbroschwitz / dabblet.css
Created April 17, 2012 20:26 — forked from LeaVerou/dabblet.css
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@pbroschwitz
pbroschwitz / dabblet.css
Created April 18, 2012 12:34 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.teaser {
overflow: hidden;
height: 250px;
display: inline-block;
position: relative;
outline:0 none}
@pbroschwitz
pbroschwitz / dabblet.css
Created May 6, 2012 17:44 — forked from LeaVerou/dabblet.css
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
@pbroschwitz
pbroschwitz / clean-caches.sh
Created June 13, 2012 08:43
Clean cache directories
#!/usr/bin/env bash
#SCRIPT_PATH="$(readlink -f $0)"
#SCRIPT_DIR="$(dirname ${SCRIPT_PATH})"
SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)"
function deleteIfExisting {
local dirToDel="${SCRIPT_DIR}/${1}"
if [[ -w "${dirToDel}" ]] ; then
echo "Deleting '${dirToDel}' ..."
@pbroschwitz
pbroschwitz / sprite.scss
Created June 15, 2012 12:52
Sass sprite mixin
@mixin sprite($width, $height, $x, $y, $asset : "../img/assets.png") {
width:$width;
height:$height;
background-image:url($asset);
background-position:$x $y;
background-repeat:no-repeat;
color:transparent !important;
text-indent:-999em;
padding:0;
display:inline-block;
@pbroschwitz
pbroschwitz / get-current-page-url.php
Created June 18, 2012 23:18
Get current page url
// @see http://css-tricks.com/snippets/php/get-current-page-url/?utm_source=dlvr.it&utm_medium=twitter
function getUrl() {
$url = @( $_SERVER["HTTPS"] != 'on' ) ? 'http://'.$_SERVER["SERVER_NAME"] : 'https://'.$_SERVER["SERVER_NAME"];
$url .= ( $_SERVER["SERVER_PORT"] !== 80 ) ? ":".$_SERVER["SERVER_PORT"] : "";
$url .= $_SERVER["REQUEST_URI"];
return $url;
}
@pbroschwitz
pbroschwitz / es6.js
Created June 21, 2012 16:08 — forked from paulrouget/es6.js
Some ECMAScript 6 element are available in Firefox
// To test this code in Firefox, I encourage you to use Firefox Aurora
// and to include your script this way:
// <script type="application/javascript;version=1.8">
/* let ********************************************* */
// let is the new var :)
// Declares a block scope local variable
var a = 5;
@pbroschwitz
pbroschwitz / dabblet.css
Created June 25, 2012 08:48 — forked from LeaVerou/dabblet.css
CSS Box model demo
/**
* CSS Box model demo
*/
#box {
width: 300px;
height: 200px;
padding: 20px;
border-width: 15px;
box-sizing: border-box;
@pbroschwitz
pbroschwitz / dot-htaccess-cwo
Created August 11, 2012 10:40
htaccess (cwo)
<IfModule mod_rewrite.c>
#Options +FollowSymLinks +ExecCGI
RewriteEngine On
#RewriteBase /
#RewriteBase /PHP/nfm-matenight-lottery/
# This makes serves up the public asset if it exists
RewriteCond public/$1 -F
RewriteRule ^(.*)$ public/$1 [QSA,L]
@pbroschwitz
pbroschwitz / supplant.js
Created October 15, 2012 07:58
supplant - Crockford
/**
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
*
* Written by Douglas Crockford
* http://www.crockford.com/
*/
String.prototype.supplant = function (o) {