Skip to content

Instantly share code, notes, and snippets.

@christiangenco
christiangenco / videos.js
Created March 28, 2012 11:24 — forked from csabapalfi/videos.js
Download and Organize Coursera videos
$("h3.list_header").each(function(sectionIndex){
var sectionName = $(this).text().replace(/Chapter .+ - /,"").replace(/\:/,'-').replace(/^(V|I|X)+\. /,'');
$(this).parent().next().find("a.lecture-link").each(function(videoIndex){
var $lectureLink = $(this);
var videoName = $.trim($lectureLink.text());
var downloadLink = $lectureLink.attr('href').replace('view','download.mp4');
var cookieHeader = ' --header \"Cookie:'+ document.cookie + '\" ';
var directory = (sectionIndex+1) + '. ' + sectionName + '/';
var filename = directory + (videoIndex+1) + '. ' + videoName + '.mp4';
@christiangenco
christiangenco / bitcoin_address_validator.rb
Last active January 2, 2016 19:09 — forked from sashazykov/bitcoin_address_validator.rb
Simple Rails bitcoin address validation. Doesn't calculate the checksum or anything fancy - just checks that the address starts with a 1 or 3, consists only of alphanumeric characters, and is 27-34 characters long (from https://en.bitcoin.it/wiki/Address).
class User < ActiveRecord::Base
validates :bitcoin_address, format: { with: /\A(1|3)[a-zA-Z1-9]{26,33}\z/,
message: "invalid bitcoin address" }
end
@christiangenco
christiangenco / download_egghead_videos.md
Last active January 29, 2024 03:16 — forked from ldong/download_egghead_videos.md
download egghead videos
@christiangenco
christiangenco / migrateHeroicons.js
Last active March 29, 2024 11:34 — forked from PicchiKevin/migrate.sh
Heroicons v1 to v2
const fs = require("fs");
if (!fs.existsSync("package.json")) {
console.error(
"Cannot find package.json. Please run this script in your project directory."
);
process.exit(1);
}
const package = fs.readFileSync("package.json", "utf8");