Skip to content

Instantly share code, notes, and snippets.

@tannerhodges
tannerhodges / home.blade.php
Last active January 21, 2016 16:16
Example Laravel Views
@extends('layouts.site')
@section('content')
<section>
<h1>Heading</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<a href="#">Go to Page</a>
</section>
@tannerhodges
tannerhodges / pad.js
Created January 11, 2016 15:21
Zero pad a number. Defaults to 2 zeros.
/**
* Zero pad a number. Defaults to 2 zeros. Can optionally pad arbitrary
* lengths and characters.
*
* Based on:
* - "pad a string to get to a determined length?" http://stackoverflow.com/a/14760377/1786459
* - "Repeat Character N Times" http://stackoverflow.com/a/1877479/1786459
*
* @param {Number} num
* @param {Number} length
@tannerhodges
tannerhodges / bjgg-crop-mobile-images.css
Created December 2, 2015 21:23
BJGG: Scale and crop tall background images for smaller screens
/* Scale and crop tall background images for smaller screens */
@media (max-width: 767px) {
.opening.homepage .row {
background-image: none;
}
.opening.homepage .mt {
height: auto;
padding: 0 0 90%; /* Lower this value as the image gets too tall */
background-image: url("http://stg-bjgg.cottontest.com/resources/~style/../%7Eimg/home/Home-opening-750x700.jpg");
@tannerhodges
tannerhodges / ordinal.php
Created November 25, 2015 15:40
Display numbers with ordinal suffix, or optionally only the suffix.
/**
* Display numbers with ordinal suffix, or optionally only the suffix (helpful
* for handling superscripts, etc).
*
* Based on http://stackoverflow.com/a/3110033/1786459
*
* @param Integer $number
* @param Boolean $suffix_only
* @return String
*/
@tannerhodges
tannerhodges / filter_foreignobject.js
Created November 24, 2015 15:47 — forked from basecode/filter_foreignobject.js
SVGFilter + SVGForeignObjectElement
<svg width="500" height="500" style="background-color:orange;" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="dropShadowStack">
<feGaussianBlur stdDeviation="3"/>
<feOffset dx="3" dy="3" result="offsetblur"/>
<feFlood flood-color="#720"/>
<feComposite in2="offsetblur" operator="in"/>
<feMerge>
<feMergeNode/>
<feMergeNode in="SourceGraphic"/>
@tannerhodges
tannerhodges / spatialite-gui-failed-to-build.txt
Created November 20, 2015 14:32
spatialite-gui failed to build
> brew install libspatialite spatialite-tools spatialite-gui
Warning: libspatialite-4.3.0a already installed
==> Installing dependencies for spatialite-tools: readosm
==> Installing spatialite-tools dependency: readosm
==> Downloading https://www.gaia-gis.it/gaia-sins/readosm-1.0.0e.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/readosm/1.0.0e
==> make install
🍺 /usr/local/Cellar/readosm/1.0.0e: 26 files, 308K, built in 25 seconds
==> Installing spatialite-tools
@tannerhodges
tannerhodges / widows.php
Last active November 19, 2015 22:03
Fix widows by adding an `&nbsp;` between the last `n` words of a string (defaults to the last 3 words).
// Courtesy of @cgutierrez
function fixWidows($text, $minWords = 3)
{
$words = preg_split('/\s+/', $text);
$textLength = count($words);
if (count($words) > $minWords) {
$widows = implode('&nbsp;', array_splice($words, ($minWords) * -1));
}
@tannerhodges
tannerhodges / svg-breaks-in-safari-8-and-below.svg
Last active October 26, 2015 17:38
SVG breaks in Safari 8 and below but works in IE 9+
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tannerhodges
tannerhodges / Default (OSX).sublime-keymap
Last active September 20, 2017 14:55
Sublime Text 3 Settings
[
// Default
{ "keys": ["shift+super+r"], "command": "goto_symbol_in_project" },
{ "keys": ["super+k", "super+t"], "command": "title_case" },
{ "keys": ["super+l", "super+s"], "command": "sort_lines", "args": { "case_sensitive": false } },
{ "keys": ["super+l", "super+u"], "command": "permute_lines", "args": { "operation": "unique" } },
{ "keys": ["super+l", "super+r"], "command": "permute_lines", "args": { "operation": "reverse" } },
{ "keys": ["shift+alt+w"], "command": "toggle_setting", "args": { "setting": "word_wrap"} },
{ "keys": ["ctrl+alt+l"], "command": "toggle_setting", "args": { "setting": "line_numbers" } },
// Macros
@tannerhodges
tannerhodges / responsive-font-size.css
Created October 6, 2015 19:38 — forked from AllThingsSmitty/responsive-font-size.css
Font size based on viewport size
/* base font size + viewport height + viewport width */
h1 {
font-size: calc(2rem + 4vh + 4vw);
}
/* responsive font-size responsive */
html {
font-size: calc(100% + .2vh + .2vw);
}