Skip to content

Instantly share code, notes, and snippets.

View franckverrot's full-sized avatar
📚
🥋

Franck Verrot franckverrot

📚
🥋
View GitHub Profile
require "rubygems"
require "hpricot"
require "open-uri"
class TvRage
def self.full_schedule(country='US')
doc = self.fetch_xml('http://services.tvrage.com/feeds/fullschedule.php', 'country' => country, '24_format' => '1')
p "full_schedule - #{doc.class}"
doc.search('//show').each {|show| process_show(show) }
end
It's very quick to setup and enjoy. In your config/environment.rb file, just put:
[...]
Rails::Initializer.run do |config|
[...]
config.middleware.use "CodeBeautifier" do
spaces 4
content_types ["text/html", "application/xml"]
end
[...]
end
import cgi
from django.utils import simplejson
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
class Hook(db.Model):
name = db.TextProperty()
zsh % gem webhook --global --add http://gemhooker.appspot.com/hooks
Enter your Gemcutter credentials. Don't have an account yet? Create one at http://gemcutter.org/sign_up
Email: franck verrot gemcutter's email
Password:
Signed in. Your api key has been stored in ~/.gem/credentials
Adding webhook...
Successfully created webhook for all gems to http://gemhooker.appspot.com/hooks
zsh % gem install gemcutter
Thanks for installing Gemcutter! You can now run:
gem push publish your gems for the world to use and enjoy
gem owner allow/disallow others to push to your gems
gem webhook register urls to be pinged when gems are pushed
========================================================================
POST /hooks HTTP/1.1
Host: gemhooker.appspot.com
Accept: */*
Content-Type: application/json
Content-Length: 260
{ "name": "My fake name", "info": "My fake info", "version": "6.6.6", "version_downloads": 10000000, "authors": "Cesario", "downloads": 1000000000000, "project_uri": "http://www.dev-fr.com", "gem_uri": "http://gemcutter.org/gems/my_fake_gem.6.6.6.gem"}
from google.appengine.ext import webapp
from google.appengine.api import xmpp
from google.appengine.ext.webapp.util import run_wsgi_app
class XMPPHandler(webapp.RequestHandler):
def post(self):
from = self.request.get('from') # XMPP style
message = xmpp.Message(self.request.POST)
message.reply("You "+message.body)
application: gemtalker
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: gemtalker.py
inbound_services:
import simplejson
import urllib2
GEMCUTTER_API_URL = "http://gemcutter.org/api/v1/"
API_KEY_URL = GEMCUTTER_API_URL + "api_key"
GEMS_URL = GEMCUTTER_API_URL + 'gems/'
GEM_SEARCH_URL = GEMCUTTER_API_URL + 'search.json?query='
class Gem(object):
def __init__(self, jsoned_gem, format='json'):
<cesario@w:~/myapp> (git)-[master]-% mkdir bin
<cesario@w:~/myapp> (git)-[master]-% git add bin
<cesario@w:~/myapp> (git)-[master]-% cp /path/to/your/bin/mybin bin/
<cesario@w:~/myapp> (git)-[master]-% git add bin/mybin
<cesario@w:~/myapp> (git)-[master]-% git status
~/myapp/
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#