Skip to content

Instantly share code, notes, and snippets.

View mukkoo's full-sized avatar

Filippo Gangi Dino mukkoo

  • TheFork
  • Turin, Italy
View GitHub Profile
@joyeecheung
joyeecheung / reverseChild.js
Last active August 29, 2015 14:07
Reverse the children of an DOM Element while preserving their CSS styles and event listeners. Due to their incorrect implementation of `children`, this might no work in IE8-.
function reverseChild(pare) {
if (!pare.children || pare.children.length < 2) return;
var emptyParent = document.createElement(pare.nodeName);
var detachedParent = pare.parentNode.replaceChild(emptyParent, pare);
var emptyLeft = document.createElement(detachedParent.children[0].nodeName);
var emptyRight = document.createElement(detachedParent.children[0].nodeName);
for (var i = 0, len = detachedParent.children.length; i < Math.floor(len/2); i++) {
var left = detachedParent.replaceChild(emptyLeft, detachedParent.children[i]);
require 'nokogiri'
require 'open-uri'
require 'rss'
def read_list()
f = File.open("feeds.txt", "r")
urls = f.readlines
f.close
urls.each do |url|