Skip to content

Instantly share code, notes, and snippets.

@adeelejaz
adeelejaz / jquery.browser.js
Last active January 9, 2018 18:15
jQuery $.browser as a separate file in case you do not want to include the full migration file
(function( jQuery, window, undefined ) {
"use strict";
var matched, browser;
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
@adeelejaz
adeelejaz / downloader.rb
Last active August 29, 2015 14:06
How to download a bunch of files in Rails and save them?
require 'open-uri'
arr = ['http://example.com/file1.txt', 'http://example.com/file2.txt']
arr.each do |url|
open(url.split('/').last, 'wb') do |file|
file << open(url).read
end
end