Skip to content

Instantly share code, notes, and snippets.

@robsmops
robsmops / h5bp-twitter-bootstrap
Created December 9, 2012 11:22 — forked from paulirish/h5bp-twitter-bootstrap
install: h5bp + twitter bootstrap integration
#!/bin/sh
echo "
Cool, let's start.
"
src=$PWD
@robsmops
robsmops / gist:4244424
Created December 9, 2012 11:49 — forked from paulirish/gist:616412
"iframe" sitedown fallback via <object>
<!-- so it turns out that the object tag can act like an iframe
but the cool thing is you can nest object tags inside eachother for a fallback path.
what this means is you can "objectframe" a site.. and if it fails.. (site down, offline, whatever).. it'll use the next one.
so you can objectframe the live site and fallback to a screenshot.
or something.
demo at : http://jsfiddle.net/paul/CY2FQ/1/
-->
@robsmops
robsmops / utmstrip.user.js
Created December 9, 2012 11:49 — forked from paulirish/utmstrip.user.js
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.1
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http://*
// ==/UserScript==
@robsmops
robsmops / matchMedia.js
Created December 9, 2012 11:50 — forked from paulirish/matchMedia.js
media query check - matchMedia - moved to https://github.com/paulirish/matchMedia.js
/*
* matchMedia() polyfill - test whether a CSS media type or media query applies
* authors: Scott Jehl, Paul Irish, Nicholas Zakas
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* dev.w3.org/csswg/cssom-view/#dom-window-matchmedia
* in Chrome since m10: http://trac.webkit.org/changeset/72552
*/
@robsmops
robsmops / gist:4244431
Created December 9, 2012 11:50 — forked from paulirish/gist:747835
`x || (x = y)` pattern for using an incoming value otherwise using some default
// from https://twitter.com/#!/LeaVerou/status/16613276313980929
// this pattern below is common for using an incoming value otherwise using some default.
/* Bad: */ x = x ? x : y; // simple ternary.
// if x is truthy lets use it.
/* Better: */ x = x || y; // logical OR.
// you could string a bunch of these easily to grab the first non-falsy value:
@robsmops
robsmops / gist:4244482
Created December 9, 2012 11:54 — forked from paulirish/gist:854293
jQuery unserialize Form plugin
// Unserialize (to) form plugin - by Christopher Thielen
// adapted and desuckified (a little) by Paul Irish
// takes a GET-serialized string, e.g. first=5&second=3&a=b and sets input tags (e.g. input name="first") to their values (e.g. 5)
(function($) {
$.fn.unserializeForm = function(values) {
@robsmops
robsmops / jQuery: local and global! ajax Events
Created December 9, 2012 12:49
PHP: http_build_query() returns url-encoded string
/*
| PHP: http_build_query()
| my first Schnippsel - Robs
*/
http_build_query()
takes array ($_POST,$_GET array("schnipp"=>"schnapp"))
returns url-encoded string (schnipp=schnapp&plitsch=platsch&bam=bam)
<?php
// Run from the command line, so we'll grab arguments from there
// input arguments: 0=>script, 1=>file_name, 2=>temp_file
$file_name = $argv[1];
$temp_file = $argv[2];
$uploads = '/opt/lampp/htdocs/user_uploads/';
// Set up file location strings