Skip to content

Instantly share code, notes, and snippets.

View stevemeisner's full-sized avatar
💡

Steve Meisner stevemeisner

💡
View GitHub Profile
@bendc
bendc / nodelist-iteration.js
Created January 13, 2015 14:39
ES6: Iterating over a NodeList
var elements = document.querySelectorAll("div"),
callback = (el) => { console.log(el); };
// Spread operator
[...elements].forEach(callback);
// Array.from()
Array.from(elements).forEach(callback);
// for...of statement
@bosskovic
bosskovic / api_constraints.rb
Created August 19, 2014 18:56
Rails API versioning
# lib/api_constraints.rb
class ApiConstraints
def initialize(options)
@version = options[:version]
@default = options[:default]
@domain = options[:domain]
end
def matches?(req)
@carlesjove
carlesjove / custom_wp_gallery
Last active November 28, 2018 17:18
Custom gallery markup for WordPress. Put this un functions.php and it will override the default shortcode.
@deep-spaced
deep-spaced / 301 Insert.sql
Last active December 23, 2015 10:38 — forked from stevemeisner/301 Insert.sql
Updated redirect creation method for Typewriter.
INSERT INTO `redirects` (`match`, `redirect_to`, `account_id`, `created_at`, `updated_at`)
VALUES
('/old_page.php', '/new/page', 40, NOW(), NOW()),
('/old_page_two.php', '/new/page/two', 40, NOW(), NOW()),
('/old_page_three.php', '/new/page-two', 40, NOW(), NOW());
@steveosoule
steveosoule / fuzzy-match-filter.html
Created June 13, 2013 18:16
fuzzy-match-filter.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fuzzy Search</title>
</head>
<body>
<input type="search" class="search">
<p class="response"></p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
@deep-spaced
deep-spaced / Countdown.js
Last active December 11, 2015 23:19
A jQuery Countdown plugin.
// Countdown.js
// A plugin to generate a countdown to a date.
// version 1.0, January 2013
// by Andrew Anderson
;(function ( $, window, document, undefined ) {
var pluginName = "countdown",
defaults = {
year: "",
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@tsabat
tsabat / zsh.md
Last active June 30, 2026 15:31
Getting oh-my-zsh to work in Ubuntu
@cblunt
cblunt / Gemfile
Created October 21, 2011 08:55
Configure Carrierwave for Amazon S3 Storage and Heroku
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){