Skip to content

Instantly share code, notes, and snippets.

View wfendler's full-sized avatar

William Fendler wfendler

View GitHub Profile
javascript:(function(a){var b,c,d,e=$(".sound"),f=require("config").get("client_id"),g=require("lib/connect").getAuthToken(),h=require("lib/helpers/conversion-helper"),i,j,k,l,m;for(b=e.length-1;b>=0;b--){c=$(e[b]);if(0==c.find(".sc-button-download").length){var n="https://soundcloud.com"+(c.find(".soundTitle__title").attr("href")||a.location.pathname);k={url:n,client_id:f},m=function(a){return function(b){var c={client_id:f};l=require("lib/url").stringify({query:c},b.stream_url+".mp3"),d=a.find(".sound__soundActions .sc-button-group"),j=d.find(".sc-button:first")[0].className.match(/sc-button-((?:small)|(?:medium))/)[1],i=$('<a class="sc-button sc-button-download sc-button-icon sc-button-responsive">Download</a>').attr({title:"Download this sound ("+h.bytesToMB(b.original_content_size)+")",href:l}).addClass("sc-button-"+j),d.append(i)}}(c),$.getJSON("http://api.soundcloud.com/resolve.json",k).success(m)}}})(window)
this.$navItems = $('.collection-of-links');
Class.prototype.bindEvents = function() {
//
// 1. Click calls goToPage()
// - I'd like it this clean, but I can't pass an index without doing option 2 here
//
this.$navItems.on('click', $.proxy(this.goToPage, this));
//
@wfendler
wfendler / SassMeister-input.scss
Created February 25, 2014 17:34
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.5)
// Compass (v1.0.0.alpha.18)
// ----
.rat {
@extend .fractal;
}
.fractal {
@wfendler
wfendler / SassMeister-input.scss
Created February 6, 2014 18:09
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
$color-primary: #bada55;
$color-secondary: #444;
$color-text: #fff;
$color-list: color-primary, color-secondary, color-text;
var geoJson = [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-75.00, 40]
},
"properties": {
"location": "Minneapolis, MN",
"address": "5500 Wayzata Boulevard <br>Suite 800<br>Minneapolis, MN 55416<br>United States",
"phone1": "Main: +1 (763) 545-1730",
@wfendler
wfendler / featured-article.html
Last active December 25, 2015 00:59
Featured article modules re-using abstractions and creating generic class names.
<!-- Current Markup -->
<div class="category-and-time">
<p class="feature-category">Food &amp; Beverage</p>
<p class="feature-time">2 hours ago</p>
</div>
<!--
Re-using current abstractions and more generic naming convention:
Also, I'd argue a list is more-semantic than two paragraph tags in this situation.
.btn {
font-family: cujojp;
color: brightPink;
}
.btn--primary {
font-size: 2em;
}
.btn--forward {
// FILE: _mq-mixin-modern.scss
//
// standard media-query mixin with set breakpoints and the option for px-based min-width value
@mixin media-query($media-query){
@if $media-query == "hand-and-up" {
@media only screen and (min-width: $hand-start) { @content; }
}
@else if $media-query == "lap-and-up" {
@media only screen and (min-width: $lap-start) { @content; }
@wfendler
wfendler / gist:5978388
Created July 11, 2013 19:18
Building a memory/matching game. I want to start with 6 divs, clone them, and randomize the order. At this point I have an array with 12 items. Is this correct so far? I've found some functions to randomize the order of an array. That shouldn't be a problem. Once I have that, is it fastest to do a for loop and .append() to the page? Or should I …
this.$initialCardCollection.length = $('.js-memory-card');
this.fullCardCollection = [];
// this.$initialCardCollection.length has the original divs on the page that i'll clone.
for ( var i = 0; i < this.$initialCardCollection.length; i++ ) {
var $thisCard = $(this.$initialCardCollection[i]);
this.fullCardCollection.push( $thisCard );
this.fullCardCollection.push( $thisCard.clone() );
}
<div data-picture data-alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia">
<div data-src="small.jpg"></div>
<div data-src="small.jpg" data-media="(min-device-pixel-ratio: 2.0)"></div>
<div data-src="medium.jpg" data-media="(min-width: 400px)"></div>
<div data-src="medium_x2.jpg" data-media="(min-width: 400px) and (min-device-pixel-ratio: 2.0)"></div>
<div data-src="large.jpg" data-media="(min-width: 800px)"></div>
<div data-src="large_x2.jpg" data-media="(min-width: 800px) and (min-device-pixel-ratio: 2.0)"></div>
<div data-src="extralarge.jpg" data-media="(min-width: 1000px)"></div>
<div data-src="extralarge_x2.jpg" data-media="(min-width: 1000px) and (min-device-pixel-ratio: 2.0)"></div>