Skip to content

Instantly share code, notes, and snippets.

View englishextra's full-sized avatar
💜
the beat goes on

englishextra englishextra

💜
the beat goes on
View GitHub Profile
@englishextra
englishextra / swipe.js
Created March 2, 2017 12:00 — forked from SleepWalker/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.screenX;
touchstartY = event.screenY;
@englishextra
englishextra / feature-detect flexbox.js
Created February 28, 2017 16:55 — forked from davidhund/feature-detect flexbox.js
The simplest feature-detect for flexbox?
/*
* Trying to feature-detect (very naive)
* CSS Flexbox support.
* - Only most modern syntax
*
* Is this nonsense?
*/
(function NaiveFlexBoxSupport(d){
var f = "flex", e = d.createElement('b');
@englishextra
englishextra / manifest.json
Created February 27, 2017 13:35
englishextra.github.io-manifest.json
{
"name": "englishextra",
"short_name": "englishextra",
"manifest_version": 2,
"icons": [{
"src": "/favicon-16x16.png",
"sizes": "16x16",
"type": "image/png"
},
{
/* This is a small sampling of the various approaches to media queries. The
point is: they're all over the board. Part of the "issue" (if you can call
it that) may be due to the intended audience of each site/framework. Another
may be that it's really difficult to test for a lot of different devices.
Regardless, it would be really nice if there was standard baseline that
could be used as a starting point for maximum compatibility and coverage. */
/* ==========================================================================
Frameworks
========================================================================== */
<!DOCTYPE html>
<!-- Edit this and the preview will update automatically. -->
<svg xmlns='http://www.w3.org/2000/svg' width='6' height='6'>
<rect width='6' height='6' fill='transparent'/>
<rect width='2' height='2' fill='#474747'/>
</svg>
@englishextra
englishextra / index.html
Created December 31, 2016 22:54 — forked from anonymous/index.html
Isotope - packery gutter
<h1>Isotope - packery gutter</h1>
<div class="grid">
<div class="grid-item grid-item--width2"></div>
<div class="grid-item grid-item--height2"></div>
<div class="grid-item"></div>
<div class="grid-item"></div>
<div class="grid-item grid-item--width2 grid-item--height2"></div>
<div class="grid-item grid-item--width2"></div>
<div class="grid-item grid-item--width2"></div>
@englishextra
englishextra / loadScript.js
Created December 29, 2016 20:36 — forked from micahjon/loadScript.js
Promise-based Asynchronous Script Loader
/**
* Loads javascript file by url and saves reference to it by name, so it's not loaded again
* @param {string} name Name of js library
* @param {string} url Url to js library
* @return {promise} Resolves when library is loaded
*
* Based on example by Brad Berger: https://bradb.net/blog/promise-based-js-script-loader/
* Extended w/ global variable to keep track of previously loaded scripts.
* Removed support for loading several independent scripts at once via Promise.all()
*
@englishextra
englishextra / gist:5bce24b8b4276c19c33d5bbf64453222
Created December 29, 2016 14:11 — forked from getify/gist:670840
using LABjs to load from a CDN, with simple error detection (& timeout), and a local load fallback
function test_jQuery() { jQuery(""); }
function success_jQuery() { alert("jQuery is loaded!");
var successfully_loaded = false;
function loadOrFallback(scripts,idx) {
function testAndFallback() {
clearTimeout(fallback_timeout);
if (successfully_loaded) return; // already loaded successfully, so just bail
try {
scripts[idx].test();
@englishextra
englishextra / timestamp.js
Created December 20, 2016 09:38 — forked from hurjas/timestamp.js
Print out a nicely formatted timestamp in JavaScript.
/**
* Return a timestamp with the format "m/d/yy h:MM:ss TT"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
var now = new Date();
// Create an array with the current month, day and time
@englishextra
englishextra / Gruntfile.js
Last active October 30, 2016 23:34
testing jshint ignore comments
module.exports = function (grunt) {
grunt.initConfig({
jshint: {
all: ['Gruntfile.js', 'diy/libs/spa-englishextra/js/test.js']
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('default', 'jshint');
};