Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Reading your blog posts

Šime Vidas simevidas

🤓
Reading your blog posts
View GitHub Profile
View gulpfile.js
var gulp = require('gulp');
// server
var server = require('gulp-express');
var livereload = require('gulp-livereload');
// css
var stylus = require('gulp-stylus');
var autoprefixer = require('gulp-autoprefixer');
var minify = require('gulp-minify-css');
// js
var browserify = require('gulp-browserify');
View ARIA-tabs.js
var $ = jQuery;
// Config = selectors for UL (tabs) and SECTION (panel) elements + which tab should be selected on init
var $list = $('.topbar__tabs');
var $sections = $('.tabbed-section');
var selected_index = 1;
// Caching the LI and A elements since they’ll be heavily used in the code
@simevidas
simevidas / gist:1c47cd54e9287eb376d5
Created Feb 24, 2015
ARIA tabs fork used on WPD (snapshot)
View gist:1c47cd54e9287eb376d5
var $ = jQuery;
var $list = $('.topbar__tabs');
var $sections = $('.tabbed-section');
var selected_index = 0;
var $items = $list.children('li');
var $anchors = $list.find('a');
// The setup
View gist:1d4266c4bd9737ee199a
default-src
'self'
;
script-src
'self'
https://a.disquscdn.com/
https://hashtagsecurity.disqus.com
code.jquery.com
;
img-src
@simevidas
simevidas / gist:b8625d9a91ac5160d503
Created Mar 7, 2015
The current Shumway SWF whitelist
View gist:b8625d9a91ac5160d503
http://g-ecx.images-amazon.com/*/AiryBasicRenderer*.swf
http://z-ecx.images-amazon.com/*/AiryFlashlsRenderer._TTW_.swf
http://ia.media-imdb.com/*/AiryFlashlsRenderer._TTW_.swf
@simevidas
simevidas / gist:74a1d8a85fefe2cc74bc
Last active Aug 29, 2015
Logging CSS will-change usage on live sites
View gist:74a1d8a85fefe2cc74bc
// Paste this into the browser’s JavaScript console
function walkTheDOM(node, func) {
func(node);
node = node.firstChild;
while (node) {
walkTheDOM(node, func);
node = node.nextSibling;
}
}
@simevidas
simevidas / es6-numbers-summary.md
Last active Sep 21, 2015
A summary of Nicolas Bevacqua’s post on ES6 Number improvements
View es6-numbers-summary.md

ES6 Number improvements

  • use the 0b prefix for binary, and the 0o prefix for octal integer literals
  • Number.isNaN and Number.isFinite are like their global namesakes, except that they don’t coerce the argument to Number
  • Number.parseInt and Number.parseFloat are exactly the same as their global namesakes
  • use Number.isInteger to check if the argument is a Number value that doesn’t have a decimal part
  • use Number.EPSILON to check if the difference between two Number values is negligible (e.g. the difference between 0.1 + 0.2 and 0.3 is negligible)
  • Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER are the largest and smallest integers that can be safely and precisely represented in JavaScript
  • use Number.isSafeInteger to check if an integer is within those bounds
View sort-tweets.js
(function(){
'use strict';
// Twitter overwrites console.log; this restores it
console.log = Object.getPrototypeOf(console).log;
let $container = $('.stream-items');
let $items = $container.children('.stream-item');
console.log(`Number of items at the beginning: ${$items.length}`);
View gist:5930986

Articles about flexbox:

View encoding.html
<head>
<script>document.write('<meta charset="utf-8">')</script>
</head>
<body>
<script>
document.body.innerHTML += "✓";
</script>
</body>
You can’t perform that action at this time.