Skip to content

Instantly share code, notes, and snippets.

@crm114
crm114 / itunes_to_rss.rb
Last active February 19, 2020 09:33
Get RSS feeds for iTunes Podcast links
# gem install httparty
# gem install nokogiri
# gem install feedjira
module ItunesToRSS
def self.extract(url)
headers = { 'User-Agent' => 'iTunes/10.1 (Windows; U; Microsoft Windows XP Home Edition Service Pack 2 (Build 2600)) DPI/96' }
base_url = 'http://itunes.apple.com/podcast/'
podcast_id = url.match(/id\d+/).to_s
itunes_response = HTTParty.get("#{base_url+podcast_id}", headers: headers)

Keybase proof

I hereby claim:

  • I am crm114 on github.
  • I am crm114 (https://keybase.io/crm114) on keybase.
  • I have a public key whose fingerprint is BD34 54CE CA2F 8D5F 0905 C6BB 4D34 2E2A 29B9 C4FF

To claim this, I am signing this object:

@crm114
crm114 / togeo.rb
Created November 26, 2012 04:15 — forked from tmcw/togeo.py
geo-assign any arbitrary image to a geotiff usable in tilemill
require 'rio'
indir = ARGV[0]
files = rio(indir).entries['*.jpg']
files.each do |infile|
res = `python togeo.py #{infile}`
end
@crm114
crm114 / resultados.rb
Created November 13, 2012 23:40 — forked from tallclouds/resultados.rb
Resultados Elecciones de Puerto Rico en Ruby
#!/usr/bin/env ruby
# sudo port install jp2a (Mac OS X)
# sudo apt-get install jp2a (Ubuntu/Debian)
# gem install httparty
# gem install hashie
# gem install hirb
class Candidate
@@base_url = 'http://207.150.251.12/REYDI_NocheDelEvento/'
@crm114
crm114 / send_test.rb
Created July 21, 2012 19:35
Sinatra: Send method test
require 'sinatra'
class Car
def mpg
return "50 MPG"
end
def length
return "2.5 meters"
end
@crm114
crm114 / gist:3113406
Created July 14, 2012 21:17
Django vs Rails
class Lesson
include Mongoid::Document
field :title, type: String
field :body, type: String
field :release_date, type: Date
field :pdf, type: String
field :image, type String
field :audio, type: String
end
function expand() {
$(this).hide();
var parent;
parent = $(this).parents(".span4");
console.log(parent);
$(parent).contents().find("a.collapse-translation").show();
$(parent).css("height", "auto");
$(parent).children(".extra-content").slideDown();
return false;
@crm114
crm114 / gist:2404176
Created April 17, 2012 07:26
navbar/login fix
// Dirty fix | Line 120
<div class="container" style="width: 980px;">
// CSS Fix
<div class="container" id="navbar">
// Add rule to CSS
@crm114
crm114 / ephemcalc.py
Created April 13, 2014 21:40
SpaceApps Challenge 2014. Calculate ephemerides given a set of Earth coordinates (Latitude, Longitude), time and altitude. The API accepts TLE data for satellites and xephem data for space bodies.
from flask import Flask, jsonify, request
from datetime import tzinfo, timedelta, datetime
import json
import ephem
app = Flask(__name__)
@app.route("/spacebody")
def spacebody():
@crm114
crm114 / csv2json.rb
Created March 28, 2014 19:56
CSV to JSON
#!/usr/bin/env ruby
# encoding UTF-8
require 'csv'
require 'json'
require 'open-uri'
# Check if we're working with an URL or filename
if ARGV[0].match(URI.regexp)
file = File.open(open(ARGV[0]))