Skip to content

Instantly share code, notes, and snippets.

@lifo101
lifo101 / jquery.placeholder.js
Last active October 7, 2015 13:08
jquery plugin that adds HTML5 "placeholder" support for browsers that do not natively support it
// add HTML5 'placeholder' support to selected inputs if not natively supported.
// @example:
// $(':text[placeholder]').placeholder();
// @css:
// input.placeholder { color: #aaa; } /* since IE doesn't properly support :not() */
//
(function($){
if (document.createElement('input').placeholder !== undefined) {
$.fn.placeholder = $.noop;
} else {
@gagarine
gagarine / template.tpl.php
Created July 29, 2012 21:11
Working with drupal theme_menu_tree
<?php
/**
* Theme_menu_tree doesn't provide any context information
* THIS SUCKS
* But you can use hook_block_view_alter to change the theme wrapper
* OUF!
*/
function MYTHEME_menu_tree(&$variables) {
@balsama
balsama / twitter-un-filter.php
Created December 4, 2012 08:12
Function to convert all valid twitter usernames into links to their twitter page.
<?php
function twitter_un_filter($string) {
$handles = preg_replace_callback('/@([A-Za-z0-9_]+)/',
create_function(
'$handles',
'
$username = substr($handles[0], 1);
$handles = "<a href=\"https://twitter.com/" . $username . "\" class=\"twitter-un-filter-link\">" . $handles[0] . "</a>";
return $handles;
'
@balsama
balsama / gist:5221f66d8c7e7ec8cfb3
Last active August 29, 2015 14:01
Track actual browser width (not screen resolution) in Google Analytics.
/**
* Creates a Google Analytics Event on page load that tracks which default
* Bootstrap screen width category the user's browser falls into.
*
* See http://getbootstrap.com/css/#grid-media-queries
*/
var width = window.innerWidth || document.body.clientWidth;
var bootstrapSize = 'Extra Small (xs)';
if (width >= 768) {
bootstrapSize = 'Small (sm)';
@derhasi
derhasi / build.sh
Created April 23, 2015 09:32
A build script for creating a build branch with all composer dependencies. Needs https://github.com/derhasi/staging
#!/usr/bin/env bash
########################################################################################################################
#
# BUILD SCRIPT
#
# Currently the build is triggered from the current branch!
#
# The build script builds a new branch from the current branch by installing all dependencies and allowing those
# dependencies to be checked in with using .build.gitignore.
@subfuzion
subfuzion / curl.md
Last active July 25, 2024 08:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@TravisCarden
TravisCarden / README.md
Last active January 8, 2024 03:16
iTerm2 status bar component for the latest Git commit message

iTerm2 status bar component for the latest Git commit message

screenshot

Generate the component text

# bash: Place this in .bashrc.
# zsh: Place this in .zshrc.
test -e "${HOME}/.iterm2_shell_integration.zsh" &amp;&amp; source "${HOME}/.iterm2_shell_integration.zsh"