Skip to content

Instantly share code, notes, and snippets.

View AleksandrDarmeiko's full-sized avatar

Aleksandr D. AleksandrDarmeiko

View GitHub Profile
@sixones
sixones / qsa-polyfill-ie7.js
Last active August 31, 2017 11:38 — forked from connrs/qsa-polyfill-ie7.js
IE7 polyfill for document.querySelectorAll
if (!document.querySelectorAll) {
document.querySelector = function(selector) {
return document.querySelectorAll(selector)[0];
}
document.querySelectorAll = function(selector) {
if (document.__querySelectorAllStylesheet === undefined) {
document.__querySelectorAllStylesheet = document.createStyleSheet();
}
@connrs
connrs / qsa-polyfill-ie7.js
Created May 18, 2012 09:49
IE7 querySelectorAll polyfill
if (!document.querySelectorAll) {
document.querySelectorAll = function(selector) {
var doc = document,
head = doc.documentElement.firstChild,
styleTag = doc.createElement('STYLE');
head.appendChild(styleTag);
doc.__qsaels = [];
styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}";
window.scrollBy(0, 0);
@jszmajda
jszmajda / test_http_clients.rb
Created February 10, 2011 22:26
a benchmark to test Net::HTTP, HTTParty, Curb, and system curl
require 'rubygems'
require 'httparty'
require 'curb'
require 'net/http'
require 'benchmark'
include Benchmark
RUNS = 1000
url = 'http://localhost:4567/'