Skip to content

Instantly share code, notes, and snippets.

View joelstein's full-sized avatar

Joel Stein joelstein

View GitHub Profile
@joelstein
joelstein / _mixins.scss
Last active February 1, 2017 13:33
Horizontal list mixins
// Standard horizontal list, using word-spacing trick to remove whitespace
// between inline-block elements.
@mixin horizontal-list {
padding: 0;
text-align: center;
word-spacing: -1em;
display: table;
width: 100%;
li {
@joelstein
joelstein / TODO.md
Last active August 29, 2015 13:57
Vagrant
@joelstein
joelstein / gist:9370369
Last active August 29, 2015 13:57
Angular sticky list (requires jQuery)
// Sticky list directive.
angular.module('stickylist', []).directive('stickyList', function() {
// Stick header by setting the position to fixed, top to 0, and adding a
// "sticky" class so additional CSS can be applied. Padding is added to
// parent <li>.
var stick = function($header) {
$header.css({position: 'fixed', top: 0}).addClass('sticky');
$header.parent().css('paddingTop', $header.outerHeight());
}
@joelstein
joelstein / gist:9349638
Last active August 29, 2015 13:57
ESRI Angular directive
// ESRI directive.
angular.module('esri', []).directive('esri', function() {
return {
scope: {
address: '=',
zoomable: '=',
enabled: '='
},
link: function(scope, element, attrs) {
var map;
@joelstein
joelstein / gist:5482015
Last active December 16, 2015 19:00
Condensed function for injecting arguments into SQL query, properly escaped and quoted. Uses recursive anonymous function for nested arguments.
<?php
/**
* Returns query with escaped args injected into query.
*
* @param string $sql The query string.
* @param array $args The arguments to escape, quote, and inject into the query.
*/
function query($sql, $args = array()) {
$quote = function($value) use (&$quote) {