Skip to content

Instantly share code, notes, and snippets.

Dillon de Voor CrocoDillon

Block or report user

Report or block CrocoDillon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@CrocoDillon
CrocoDillon / Services and frameworks.md
Created Jan 16, 2015
Error logging services and frameworks
View Services and frameworks.md

Error logging

Why? Because this is the only way to find all errors your users see but you don't. Only thing left that could fail without you knowing about it is the service or framework itself so let's hope that's well tested or... errorception!

I guess it should possible to log something like "okay, I'm loaded and ready to catch them errors" to make sure everything works as expected but I degress.

You can also read something like http://blog.meldium.com/home/2013/9/30/so-youre-thinking-of-tracking-your-js-errors about JS error tracking.

Below you will find some resources I collected during a very not extensive Google search, I might add more later.

@CrocoDillon
CrocoDillon / SassMeister-input.scss
Created Nov 20, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
@mixin center($max-width) {
width: 100%;
max-width: $max-width;
margin: 0 auto;
}
@CrocoDillon
CrocoDillon / SassMeister-input.scss
Created Sep 26, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
$col-map: ();
@mixin col-span($cols, $total) {
$width: ($cols/$total) * 100%;
@if map-has-key($col-map, $width) {
@extend #{map-get($col-map, $width)};
@CrocoDillon
CrocoDillon / SassMeister-input.scss
Created Sep 26, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
$col-map: ();
@mixin col-span($cols, $total) {
$width: ($cols/$total) * 100%;
@if map-has-key($col-map, $width) {
@extend map-get($col-map, $width);
@CrocoDillon
CrocoDillon / cookies.js
Last active Jul 2, 2019
Export your awesome module using AMD, CommonJS, Node.js or just as global.
View cookies.js
/*
* Inspiration (well… copy pasting more or less) from:
* https://github.com/ScottHamper/Cookies/blob/0.3.1/src/cookies.js#L127-L140
*
* Thanks Scott!
*/
(function (global) {
'use strict';
var MyModule = function () {
@CrocoDillon
CrocoDillon / _blank.js
Last active May 13, 2019
Automatically open external links in new tab or window.
View _blank.js
// vanilla JavaScript
var links = document.links;
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
// or in jQuery
@CrocoDillon
CrocoDillon / _guides.scss
Created Nov 21, 2013
Creates guides, useful for prototyping.
View _guides.scss
$guides-default-color: #4e68c7;
$guides-default-orientation: horizontal;
/**
* Creates guides, useful for prototyping.
*
* @param $guide-sets List of guides, which can be numbers (uses default
* color and orientation) or lists in the form (color orientation guides),
* where guides can be a single number or a list of numbers.
*/
@CrocoDillon
CrocoDillon / Get all class names.js
Last active Dec 28, 2015
Get all class names of a document. Useful for... whatever.
View Get all class names.js
var classes = [];
Array.prototype.forEach.call(document.querySelectorAll('*'), function(el) {
el.className.split(/\s/).forEach(function(cl) {
if (cl && classes.indexOf(cl) == -1)
classes.push(cl);
});
});
classes.sort();
classes.forEach(function(cl) {
console.log(cl);
View Lazy load Disqus comments.js
/*
* http://christian-fei.com/tutorials/how-to-lazy-load-disqus-comments/
*
* <div class="comments"></div>
*/
var comments = document.getElementsByClassName('comments')[0],
disqusLoaded = false;
function loadDisqus() {
You can’t perform that action at this time.