Skip to content

Instantly share code, notes, and snippets.

View rmax's full-sized avatar
:octocat:
(⌐■_■) ♬

R Max Espinoza rmax

:octocat:
(⌐■_■) ♬
View GitHub Profile
@rmax
rmax / parse_urls.py
Created June 2, 2011 14:35
using scrapy without scrapy
"""
python parse_urls.py http://somesite/foo/ ".pdf\$"
"""
import sys
import urllib2
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.http import HtmlResponse
@rmax
rmax / datauri.py
Created March 29, 2011 19:46
single script to convert a image into data uri
#!/usr/bin/env python
"""
Simple script to convert a image into data uri.
More info http://en.wikipedia.org/wiki/Data_URI_scheme
"""
import base64
import mimetypes
import sys
(function($) {
window.FlashMessages = {
init: function() {
this.container = $("#flash-messages")
.find("a.message-close")
.fadeIn("slow")
.live("click", function() {
$(this).parent()
.fadeOut("slow", function() {
$(this).remove();
(pyall)rolando@atlantis:~/src/jquery/src$ grep IE *.js
ajax.js: rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
ajax.js:// #8138, IE may throw an exception when accessing
ajax.js: // since IE will modify it given document.location
ajax.js: // to avoid any 'Permission Denied' errors in IE
ajax.js: // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
attributes.js: // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
attributes.js: // We can't allow the type property to be changed (since it causes problems in IE)
attributes.js: // convert the value to a string (all browsers do this but IE) see #1070
attributes.js: // Some attributes require a special call on IE
Test Pass 122
test_remove_filename (__main__.GridFSTest) ... FAIL
======================================================================
FAIL: test_remove_filename (__main__.GridFSTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_put.py", line 18, in test_remove_filename
self.assertEqual(f._id, id2)
AssertionError: ObjectId('4cc20c88e779893aae0002d6') != ObjectId('4cc20c88e779893aae0002d8')
import oursql
import sys
from twisted.enterprise import adbapi
from twisted.internet import defer, reactor
from twisted.python import log
log.startLogging(sys.stderr)
# Use 'test' database with default credentials
"""
http://revista.python.org.ar/1/html/revista.html#desafio-python
entrada: 11
salida: 11
entrada: 8
salida 2^3
entrada: 24
"""FizzBuzz program"""
__author__ = "Rolando Espinoza La fuente <[email protected]>"
__version__ = "1.0"
def fizzbuzz(n):
"""
Returns whether Fizz or Buzz or Fizzbuzz or number.
"""
if n % 15 == 0:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Rolando Espinoza La fuente
from scrapy.conf import settings
from scrapy.core import signals
from scrapy.core.manager import scrapymanager
from scrapy.item import Item, Field
from scrapy.selector import HtmlXPathSelector
from scrapy.spider import BaseSpider
/*
Dropbox.com hiring questions
http://www.dropbox.com/webengineer
1)
*/
function countdown(num) {
for (var i=0; i <= num; i += 1) {
setTimeout(function() {
alert(num - i);
}, i * 1000);