Skip to content

Instantly share code, notes, and snippets.

@FWeinb
FWeinb / jquery.cache.js
Last active March 25, 2021 03:53
Simple lazy evaluation pattern
(function($){
$.fn.cache = function (key, create, use){
var data = this.data(key);
if (!data){
data = create();
this.data(key, data);
}
return use(data);
};
})(jQuery);
@FWeinb
FWeinb / youtube.js
Created July 26, 2013 13:27
Open Youtube video (only) in new window.
window.open('http://www.youtube.com/embed/'+location.search.replace(/(\?|)v=([^&]*)/, '$2')+'?rel=0');
@FWeinb
FWeinb / SassMeister-input.scss
Created January 18, 2014 09:46
Controllable mixin
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
/*! sassyjson - v0.0.2 - 2014-01-17 */
// Logs an error at `$pointer` with `$string` message
// --------------------------------------------------------------------------------
// @param [string] $string: error message
// @param [number] $pointer: pointer position
@FWeinb
FWeinb / SassMeister-input.scss
Created January 23, 2014 18:23
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// SassyJSON (v1.0.9)
// ----
@import "SassyJSON";
$json-decode: json-decode('{"key" : "value\" test"}');
$json-decode1: json-decode('{"key" : "value\\" test"}');
@FWeinb
FWeinb / SassMeister-input.scss
Created January 23, 2014 19:53
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
@function _count-token-before($search, $token, $pointer){
$count: 0;
@for $i from 1 to $pointer{
$index: $pointer - $i;
@if ( str-slice($search, $index, $index) == $token){
@FWeinb
FWeinb / SassMeister-input.scss
Created January 25, 2014 18:55
Generated by SassMeister.com.
// ----
// Sass (v3.2.14)
// Compass (v0.12.2)
// ----
@function true() {
@return "STRING__TRUE";
}
@function false() {
@FWeinb
FWeinb / SassMeister-input.scss
Created February 1, 2014 12:26
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
$brands: (
twitter: (#00acee f099),
facebook: #3b5998,
pinterest: #cb2027,
soundcloud: #f60,
@FWeinb
FWeinb / SassMeister-input.scss
Created February 4, 2014 16:55 — forked from KittyGiraudel/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
@import "compass";
// Private function for custom stops
// ------------------------------------------------------------
// @param $colors: list of color + associated stop
@FWeinb
FWeinb / SassMeister-input.scss
Created February 9, 2014 13:09
Generated by SassMeister.com.
// ----
// Sass (v3.2.14)
// Compass (v0.12.2)
// ----
debug{
/* This is working */
// debug: inspect((()));
// This fails
@FWeinb
FWeinb / SassMeister-input.scss
Last active August 29, 2015 13:56
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.3)
// Compass (v1.0.0.alpha.18)
// SassyJSON (v1.1.2)
// ----
debug{
/* This is working */
// debug: inspect((()));