Skip to content

Instantly share code, notes, and snippets.

@miketierney
miketierney / SassMeister-input.scss
Created October 23, 2015 16:38
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
// current way
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}
// new way
@miketierney
miketierney / SassMeister-input-HTML.html
Created September 8, 2015 19:39
Generated by SassMeister.com.
<article>
<p>First paragraph</p>
<p>Second paragraph</p>
<p></p>
<p>Third paragraph</p>
</article>
@miketierney
miketierney / SassMeister-input.sass
Created August 11, 2014 01:47
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.7)
// ----
=e($name)
@at-root #{&}__#{$name}
@content
=m($name)
@at-root #{&}--#{$name}
@miketierney
miketierney / datastore.js
Last active December 17, 2015 23:28
An abstraction layer for working with localStorage
/**
* localStorage abstraction
* Get and Set JS Objects in localStorage
*
* This is meant for really simple localStorage needs, not to replace
* anything like Backbone.localStorage that's more robust. A good
* use-case is storing an array of IDs for models that are stored on
* the server.
*
* Usage:
@miketierney
miketierney / d3.v3.0.8.min.js
Last active December 17, 2015 04:59
Example of Modernizr (un-modified) breaking R2D3.
d3=function(){function t(t){return t.target}function n(t){return t.source}function e(t,n){try{for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}catch(r){t.prototype=n}}function r(t){for(var n=-1,e=t.length,r=[];e>++n;)r.push(t[n]);return r}function u(t){return Array.prototype.slice.call(t)}function i(){}function a(t){return t}function o(){return!0}function c(t){return"function"==typeof t?t:function(){return t}}function l(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function f(t){return null!=t&&!isNaN(t)}function s(t){return t.length}function h(t){return t.trim().replace(/\s+/g," ")}function g(t){for(var n=1;t*n%1;)n*=10;return n}function p(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}function d(t){return t.responseText}function m(t){return JSON.parse(t.responseText)}function v(t){var n=Li.createRange();return n.selectNode(Li.body),n.createContextualFragment(t.responseText)}function y(t){return t.responseXML}function M(){}function b(t){functio
@miketierney
miketierney / git-sync
Last active December 13, 2015 20:18
Useful little script to sync your current tracking branch with it's remote counter-part. Save to ~/bin as "git-sync" and then `chmod +x` to get it to work.
#!/bin/bash
#
# $ git sync
# Pulling from remote...
# Current branch master is up to date.
#
# Pushing to remote...
# Everything up-to-date
#
require 'storable'
require 'faker'
module ViewHelpers
# …
# Data Faking
class Subscriber < Storable
field :id => Integer
field :first_name
# Example of Subscriber.all (assumes you've defined the Subscriber class):
irb > Subscriber.bootstrap("./subscribers.yml")
irb > Subscriber.all
=> [#<Subscriber:0x007ffaf1ad85b0 @first_name="Mike", @id=1, @last_name="Tierney">, #<Subscriber:0x007ffaf29f07a0 @first_name="Martin", @id=2, @last_name="Arrowsmith">]
<h1>All Subscribers</h1>
<ul>
<% Subscribers.all.each do |subscriber| %>
<li>
<strong><%= subscriber.name %></strong>
<span class="sub-since">Subscriber Since <%= subscriber.created_at %></span>
</li>
<% end %>
</ul>
<% 10.times do |i| %>
<%
# Define these first, since they're being used in the key
first_name = Faker::Name.first_name
last_name = Faker::Name.last_name
%>
"<%= first_name %>_<%= last_name %>":
id: <%= i + 100 %>