Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () { | |
var Storage = function (type) { | |
function createCookie(name, value, days) { | |
var date, expires; | |
if (days) { | |
date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
expires = "; expires="+date.toGMTString(); |
<meta name="viewport" content="user-scalable=no,initial-scale=1.0,maximum-scale=1.0" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
$fileName = $_FILES['afile']['name']; | |
$fileType = $_FILES['afile']['type']; | |
$fileContent = file_get_contents($_FILES['afile']['tmp_name']); | |
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent); | |
$json = json_encode(array( | |
'name' => $fileName, | |
'type' => $fileType, | |
'dataUrl' => $dataUrl, |
<!DOCTYPE html> | |
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Breakpoint detection test</title> | |
<style type="text/css" media="screen"> | |
@media screen and (min-width: 320px) { | |
#page:after { | |
content: 'smallest'; /* represent the current width-bracket */ |
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence | |
(function(win, doc){ | |
if(win.addEventListener)return; //No need to polyfill | |
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}} | |
function addEvent(on, fn, self){ | |
return (self = this).attachEvent('on' + on, function(e){ | |
var e = e || win.event; | |
e.preventDefault = e.preventDefault || function(){e.returnValue = false} | |
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true} |
# READ MORE HERE: http://www.webdevotion.be/blog/2012/06/06/terminal-git-branch-status-colored-icons | |
# ============================================================================== | |
# FANCY GIT STATUS ICONS | |
# ============================================================================== | |
# SOME VARIABLES in capitals | |
# no whitespace between variable names and = sign! | |
COLOR_RESET="\e[00m" | |
COLOR_GREEN="\e[1;32m" | |
COLOR_RED="\e[00;31m" |
.row { margin-left: -2.12766%; } | |
/* [1] – px: 60 pct: 6.38298% */ | |
.span1 { width: 6.38298%; margin-left: 2.12766%; } | |
/* [2] – px: 140 pct: 14.89362% */ | |
.span2 { width: 14.89362%; margin-left: 2.12766%; } | |
.span2 .span1 { width: 42.85714%; margin-left: 14.28571%; } /* 60px */ | |
/* [3] – px: 220 pct: 23.40426% */ |
# Simple little script to take a Screenshot of any website | |
# | |
# Usage: phantomjs screenshot.coffee http://google.com ./google.png | |
# I've always liked automated testing tools for front-end development like Selenium | |
# and Selenium Remote Control. One of the cool features was the ability to take a screenshot | |
# if the test failed. This was always useful as sometimes I could immediately see what went | |
# wrong and then fix it based on what I saw in the screenshot. | |
# | |
# I just started playing with PhantomJS and thought "I wonder if I could replicate that!" |
Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.
Say you've downloaded node-v0.10.7-linux-x64.tar.gz
into the Downloads
directory. Then, open the terminal and type the following:
$ cd ~/Downloads
$ mkdir -p ~/local/node
$ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local/node --strip-components=1
$ echo '# Node Enviroment Setup' >> ~/.bashrc
$ echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.bashrc