Skip to content

Instantly share code, notes, and snippets.

@mshwery
mshwery / BetterBox.coffee
Created February 15, 2012 23:11
Fancybox Replacement
$.betterbox = ($obj, options) ->
defaults = {
'relativeTo' : ''
'boundTo' : ''
'outerBox' : '#outerBox'
'innerBox' : '#innerBox'
'direction' : 's' # n, e, s, w direction
'offsetTop' : 15
'maxWidth' : 420
'minWidth' : 390
@-webkit-keyframes main-bear {
from {
background-position: 0px 0px; }
to {
background-position: 0px -11550px; } }
@-moz-keyframes main-bear {
from {
background-position: 0px 0px; }
@mshwery
mshwery / Gemfile
Created July 7, 2013 22:57
Jekyll on Heroku with Rack-Jekyll
source :rubygems
gem 'jekyll'
gem 'rack-jekyll', :git => 'https://github.com/adaoraul/rack-jekyll'
gem 'coderay'
gem 'thin'
@mshwery
mshwery / shynav.js
Last active April 18, 2018 00:27
Shynav Plugin. This is a little plugin that hides/shows the nav based on scrolling. It's decoupled from the styles, so you are left to implement whatever styles meet the needs of a nav when scrolled, detached from the top, and hidden.
$.fn.shynav = function(opts) {
var elem = this;
var defaults = {
delay: 4000, // how long til shynav gets shy
minScroll: $(elem).height() || 0, // how far user scrolls before shynav does its thing
detachedClass: 'scrolled', // what class does the element get when scrolled
hiddenClass: 'hidden' // what class does the element get when hidden
};
@mshwery
mshwery / LocalStore.js
Last active August 29, 2015 14:00
Wrapper to add optional TTL for localStorage.
// polyfill for localstorage into stale storage so this data store doesnt ever fail
if (!('localStorage' in window)) {
//if (!Modernizr.localstorage) {
window.localStorage = {
_data : {},
setItem : function(id, val) { return this._data[id] = String(val); },
getItem : function(id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; },
removeItem : function(id) { return delete this._data[id]; },
clear : function() { return this._data = {}; }
};
@mshwery
mshwery / README.md
Last active August 29, 2015 14:01 — forked from mbostock/.block
Pie Chart v2

This pie chart is constructed from a JSON file storing the populations of various age groups. The chart employs a number of D3 features:

@mshwery
mshwery / app.js
Last active May 6, 2024 05:27
Gulp + Browserify + requiring .html templates + Knockout web components
var ko = require('knockout');
ko.components.register('simple-name', require('./components/simple-name/simple-name.js'));
ko.applyBindings({ userName: ko.observable() });
[
{
"requested_at":"2014-9-5 00:17:10.0",
"port":52251,
"ip":"80.1.150.234",
"response_time":0.114823,
"path":"router/RespondentAuthentication.aspx?SID=e8f8cbf4-2bbf-4d76-9519-52aed9fa6554&PID=EPO4YTQ8DRBKYXY434&RVCID=&RVPID=&RVSID=&RVTO=&RVID=",
"rcvd":11,
"statuscode":200,
"method":"POST",
@mshwery
mshwery / store.js
Last active May 7, 2018 18:14
a localStorage wrapper with time-to-live and JSON stringify/parsing
/**
* store.js
* a localStorage wrapper with time-to-live and JSON stringify/parsing
*
* @author Matt Shwery
* @license MIT (http://www.opensource.org/licenses/mit-license)
*/
store = (function () {
// polyfill for localstorage into stale storage so this data store doesnt ever fail
### Keybase proof
I hereby claim:
* I am mshwery on github.
* I am mshwery (https://keybase.io/mshwery) on keybase.
* I have a public key ASB75ykXbhcGdPS806ZNSNJG1Xp8t_uRa4dlXRvR0HArtQo
To claim this, I am signing this object: