Skip to content

Instantly share code, notes, and snippets.

@jeremyfelt
jeremyfelt / gist:2353300
Created April 10, 2012 18:05
Strip whitespace between HTML tags in wp_nav_menu()
<?php
/* Modify the output of list items in the header navigation menu.
*
* Remove the whitespace between HTML tags. Required specifically for better
* behavior when list items are inline-block in our main nav menu and need
* the browsers to adhere to exact margins.
*
* NOTE: filter name changes depending on your menu - this one works for 'navigation_items'
*/
@smeranda
smeranda / facebook_like-box_responsive.css
Created May 1, 2012 20:37
Flexible width layout for Facebook Like Box/Activity Stream to use in Responsive Designs
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
@dsheiko
dsheiko / strtr.js
Last active July 9, 2023 18:18
Java-script strtr — translate characters or replace substrings
/**
* strtr() for JavaScript
* Translate characters or replace substrings
*
* @author Dmitry Sheiko
* @version strtr.js, v 1.0.2
* @license MIT
* @copyright (c) Dmitry Sheiko http://dsheiko.com
**/
@LeeRJohnson
LeeRJohnson / foundation-grid-sized-flex-video.html
Last active December 12, 2015 08:09
Methods for controlling the scaling of video in a theme using Foundation.
<div class="row"><!-- not really need - row should exist higher in the doc -->
<div class="six columns centered"><!-- six is the width (half) but could be one through tweleve - centered centers it -->
<div class="flex-video widescreen"><!-- widescreen is for the 560 315 ratio -->
<iframe width="560" height="315" src="http://www.youtube.com/embed/N966cATFWjI" frameborder="0" allowfullscreen=""></iframe>
</div>
</div>
</div>
@raelgc
raelgc / Email Server (Linux, Unix, Mac).md
Last active May 21, 2024 11:31
Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

1 - Point localhost.com to your machine

Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to make the domain localhost.com point to your machine, including this content to the file:

127.0.0.1 localhost.com

2 - Install Postfix

#!/usr/bin/env ruby -w
# My first Ruby program
require "json"
if ARGV.empty?
puts "Usage gpx2json.rb filename"
exit
end
@markatom
markatom / createvh
Created March 3, 2015 13:23
Create virtual host
#!/bin/bash
if [ -z $1 ]; then
echo Usage: $0 project-name >&2
exit 1
fi
CONFIG=$(cat << 'END'
<VirtualHost *:80>
ServerName %name%.dev
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@aFarkas
aFarkas / focus-within.js
Last active August 20, 2020 10:49
simple focus-within polyfill
(function(window, document){
'use strict';
var slice = [].slice;
var removeClass = function(elem){
elem.classList.remove('focus-within');
};
var update = (function(){
var running, last;
var action = function(){
var element = document.activeElement;
@StevenMaude
StevenMaude / convert_gpx.sh
Last active January 29, 2023 17:29
Use gpsbabel to convert Garmin .FIT to .gpx — requires a fairly recent version of gpsbabel (minimum 1.4.3); see https://www.stevenmaude.co.uk/posts/using-garmin-forerunner-watches-with-linux for more details on using Garmin watches with Linux
#!/bin/sh
# Usage: convert_gpx.sh <FIT filename>
# Should works whether you include the .FIT extension or not.
filename=$(basename "$1" .FIT)
gpsbabel -i garmin_fit -f "$filename".FIT -o gpx -F "$filename".gpx