Skip to content

Instantly share code, notes, and snippets.

@shelldandy
shelldandy / typekit.html
Last active April 27, 2018 15:25
Master Race Typekit Solution by Glen Maddern
<head>
<script>
if (window.localStorage && window.localStorage._tk_cache) {
document.documentElement.classList.add('wf-active');
var script = document.createElement('script');
script.innerHTML = localStorage._tk_cache + ";(function () {var timeout = setTimeout(function () {document.documentElement.classList.remove('wf-active');}, 300); Typekit.load({ async: false, active: function () { clearTimeout(timeout); }});})();";
document.head.appendChild(script);
}
window._tk_onload = function () {
var req = new XMLHttpRequest()
@yannickcr
yannickcr / 1.Readme.md
Last active October 28, 2019 13:14
Testing ES6 React components with Gulp + Mocha + Istanbul

Testing ES6 React components with Gulp + Mocha + Istanbul

Recipe to test your ES6 React components.

$ npm install gulp gulp-util gulp-mocha gulp-istanbul isparta run-sequence babel jsdom

Note: You must name all your files .js, even if they contains JSX, or istanbul will not instrument them.

@thelibrarian
thelibrarian / Fixing XCode Command Line Tools.md
Last active November 6, 2017 03:28
How to fix compile errors with the XCode command line tools on Mac OS X. Solves problems such as failing to find Framework header files (e.g. ruby.h).

The Problem

If you have installed the standalone Command Line Tools for XCode on your Mac (i.e. without having XCode.app installed), some of these tools can get a bit confused due to a couple of oversights on Apple's part in finalising the setup.

Note: all commands below will need to be run from an Administrator account, or by an account with appropriate permission in /etc/sudoers.

The Solution

1. Failing to Find Frameworks

Sometime when compiling against the preinstalled Frameworks (e.g. Ruby or Python), various tools will inexplicable fail to find header files that are quite clearly there. This is caused by the fact that no XCode has been selected for the command-line tools. Wait, I hear you cry, I don't have XCode installed! Indeed, but you nonetheless need to select one, and point it somewhere where the command line tools exist, like so

@steveu
steveu / loops.scss
Created September 17, 2012 13:31
Sass/SCSS Loops
/*
Given the following html
<nav>
<ul>
<li class="home"><a>Home</a></li>
<li class="about"><a>About</a></li>
<li class="blog"><a>Blog</a></li>
<li class="contact"><a>Contact</a></li>
</ul>
</nav>
@miensol
miensol / RazorHtmlFormatter.cs
Created February 27, 2012 19:18
Razor MediaTypeFormatter
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using RazorEngine;
@danott
danott / social.js
Created November 28, 2011 22:04
Replace Twitter/Facebook/G+ scripts with one Modernizr.load call.
Modernizr.load(
[ '//platform.twitter.com/widgets.js'
, '//apis.google.com/js/plusone.js'
, { test: document.getElementById('facebook-jssdk')
, nope: '//connect.facebook.net/en_US/all.js#xfbml=1'
}
]);
/* When Using Modernizr, the above replaces all the social includes below
@jed
jed / LICENSE.txt
Created May 10, 2011 16:04 — forked from 140bytes/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bryanl
bryanl / campfire-emoji.txt
Created January 27, 2011 16:34
campfire emoji
Surround these with : e.g. :calling:
+1
-1
bulb
calling
clap
cop
email
feet
@dieseltravis
dieseltravis / ajax.cs
Created January 10, 2011 19:19
Ajax in Asp.Net with jQuery
// SomePage.aspx.cs (ASPX codebehind) function
[System.Web.Services.WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public static string GetSomeObjects(string id)
{
//TODO: get stuff here
}
@fcalderan
fcalderan / inception-javascript.js
Created November 2, 2010 09:42
inception explained as a 4 nested javascript closures
/*
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02
* I had an idea: could Inception movie be explained by a few javascript closures
* and variable resolution scope (just for fun)?
*
* Activate javascript console =)
*/
<script>
console.group("inception movie");