This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gcal {google calendar add "`echo $@`"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# csv_to_json.rb | |
# a simple utility to translate csv files to json objects | |
# using the first line of the csv file as a list of keys | |
# The keys in the first line of the csv file are downcased and | |
# underscored (ex: "First Name" => "first_name") | |
# Example usage: | |
# csv_to_json.rb my_csv_file.csv | |
# => outputs JSON interpretation of my_csv_file.csv to STDOUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'time' | |
filename = '/Users/cgenco/Dropbox/log/weight.csv' | |
File.open(filename, "a") {} # create the file if it doesn't exist | |
weight = ARGV.first | |
unless weight | |
puts "From: " + filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#simplest ruby program to read from arduino serial, | |
#using the SerialPort gem | |
#(http://rubygems.org/gems/serialport) | |
# from http://playground.arduino.cc/interfacing/ruby | |
require 'serialport' | |
require 'pry' | |
# https://github.com/igrigorik/em-websocket | |
# require 'em-websocket' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
class Integer | |
def factors() (1...self).select { |n| (self % n).zero? } end | |
end | |
class Array | |
def score(n) | |
total = n | |
minus = n.factors.inject(0) {|sum, f| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name www.dbinbox.com; | |
rewrite ^/(.*) http://dbinbox.com/$1 permanent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Usage: | |
# $ coffify app/*/* | |
# Depends on http://js2coffee.org/ | |
# npm install js2coffee | |
ARGV.each{|filepath| | |
# skip this file if it's not a .js file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
validates :bitcoin_address, format: { with: /\A(1|3)[a-zA-Z1-9]{26,33}\z/, | |
message: "invalid bitcoin address" } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wget \ | |
--recursive \ | |
--no-clobber \ | |
--page-requisites \ | |
--html-extension \ | |
--convert-links \ | |
--domains website.org \ | |
--no-parent \ | |
www.website.org/tutorials/html/ |
OlderNewer