Skip to content

Instantly share code, notes, and snippets.

@jonathantneal
jonathantneal / parseURI.js
Created August 2, 2012 23:22
parseURI // returns parsed URI as individual components
function parseURI(uri) {
function regexMaybe(string) {
return "(?:" + string + ")?";
}
uri = String(uri || window.location.href);
var
match = uri.match(new RegExp("^" + regexMaybe("([^:]+):") + "(\\/\\/)?" + regexMaybe("([^@]+)@") + "([^:/]+)/*" + regexMaybe(":(\\d+)\\/*") + regexMaybe("([^?#]+)\\/") + regexMaybe("([^?#]+)") + regexMaybe("\\?([^#]+)") + regexMaybe("#(\\w+)"))),
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 9, 2025 18:09
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@lepture
lepture / nginx.rb
Created July 2, 2012 12:52
nginx with http-concat module
require 'formula'
class Nginx < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.2.1.tar.gz'
sha1 '4fb69411f6c3ebb5818005955a085e891e77b2d8'
devel do
url 'http://nginx.org/download/nginx-1.3.2.tar.gz'
sha1 'a3507cb2f13332489804f79885541c717f8f4bf0'
@necolas
necolas / _todo.md
Created June 30, 2012 18:07
Grunt tasks to process HTML files and produce a deploy directory of optimized files
  • Avoid reprocessing the same block in different HTML files.
  • Throw warning when processing a different block to an existing destination file. Hashing will avoid collisions, but introduce confusion.
  • Add file versioning for inline media and CSS images.
  • Avoid need for 'usemin' task - get the replacement element pattern from the first/last HTML element in actual block being replaced. Added benefit of preserving other attributes that may exist (e.g. title, media).

Acknowledgements: This is an adaption of some of Mickael Daniel's work on h5bp/node-build-script

@djoyner
djoyner / gist:2946289
Created June 18, 2012 01:20
Create VIM's backup, swap and undo directories on the fly
#
# Avoid annoying startup errors by creating VIM's backup, swap and undo directories
# on the fly when they don't exist.
#
set backupdir=~/.vim/tmp/backup
set directory=~/.vim/tmp/swap
set undodir=~/.vim/tmp/undo
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p")
@lsauer
lsauer / gist:2907369
Last active January 17, 2022 09:59
Google Chrome special pages for memory, debug, resources, profiling, downloads...

####lsauer.com


###Overview of all chrome:// pages.

  • List by calling chrome://about/
  • Following is a direct dump from the 'about' page for reference

###List of Pages as per v20.xxx

@scottjehl
scottjehl / getViewportSize.js
Created March 16, 2012 19:25
Reliably get viewport dimensions in JS
/*!
An experiment in getting accurate visible viewport dimensions across devices
(c) 2012 Scott Jehl.
MIT/GPLv2 Licence
*/
function viewportSize(){
var test = document.createElement( "div" );
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;";
@johan
johan / jquery.nodoubletapzoom.js
Created March 15, 2012 22:59
A jQuery plugin to selectively disable the iOS double-tap-to-zoom action on specific page elements (and have that generate two click events instead).
// jQuery no-double-tap-zoom plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
var IS_IOS = /iphone|ipad/i.test(navigator.userAgent);
$.fn.nodoubletapzoom = function() {
if (IS_IOS)
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp
@jaigouk
jaigouk / meta-tags.md
Created March 8, 2012 18:26 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@millermedeiros
millermedeiros / gist:1873712
Created February 21, 2012 04:38
how to filter and batch delete files on node.js
var DIST_FOLDER = '../deploy/';
// ---
var _minimatch = require('minimatch'),
_wrench = require('wrench'),
_fs = require('fs'),
_path = require('path');
function purgeDeploy(){