Skip to content

Instantly share code, notes, and snippets.

💭
Inactive

J. Tangelder jtangelder

💭
Inactive
Block or report user

Report or block jtangelder

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
@Rich-Harris
Rich-Harris / promise.js
Last active Jan 11, 2020
ES6 Promise polyfill
View promise.js
( function ( global ) {
'use strict';
var Promise, PENDING = {}, FULFILLED = {}, REJECTED = {};
if ( typeof global.Promise === 'function' ) {
Promise = global.Promise;
} else {
Promise = function ( callback ) {
View slideshow.scss
/**
* @example
* div.slideshow
* div first pane
* div.active active pane
* div last pane
*/
.slideshow {
position: relative;
overflow: hidden;
View inview.js
/**
* triggers a callback when an element gets into the viewport
* uses a little bit of jQuery. elements auto receive the class `inview`
*
* the threshold parameter is on scale from 0 to 1 of the height.
* 0 means it triggers directly, 1 means it must be full visible
*
* @example
* // images needs to be 50% in view
* inview.register("img", .5, function(item, inview_state) {
@julianshapiro
julianshapiro / IE.js
Last active Aug 2, 2017
Future-Proof IE Version Detection Without User Agent Sniffing
View IE.js
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {
@jtangelder
jtangelder / jquery.raf.coffee
Last active Dec 21, 2015
hack jQuery to use requestAnimationFrame for animations
View jquery.raf.coffee
# hack jQuery to use requestAnimationFrame for animations
((win, $)->
# use Modernizr to get the (prefixed)DOM method
raf = Modernizr.prefixed('requestAnimationFrame', win)
if not raf
return
animating = false;
@nijikokun
nijikokun / base64-utf8.module.js
Last active Jan 4, 2020
Javascript Base64 UTF8 for the Browser / Server. Base64 UTF-8 Encoding and Decoding Libraries / Modules for AMD, CommonJS, Nodejs and Browsers. Cross-browser compatible.
View base64-utf8.module.js
// UTF8 Module
//
// Cleaner and modularized utf-8 encoding and decoding library for javascript.
//
// copyright: MIT
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com
(function (name, definition, context, dependencies) {
if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); }
else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); }
else { context[name] = definition.apply(context); }
@zenkay
zenkay / gist:3237860
Created Aug 2, 2012
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion
View gist:3237860

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

View gist:527683
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
You can’t perform that action at this time.