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
# this is the correct program | |
import re | |
import urllib2 | |
# get_next_target() takes a page and checks for the positions of the links | |
def get_next_target(page): | |
match=re.findall(r'[\w.-]+@[\w.-]+',page) | |
if match: | |
return match |
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
#!flask/bin/python | |
from flask import Flask, jsonify, abort, request, make_response, url_for | |
from flask.ext.httpauth import HTTPBasicAuth | |
app = Flask(__name__, static_url_path = "") | |
auth = HTTPBasicAuth() | |
@auth.get_password | |
def get_password(username): | |
if username == 'miguel': |
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
# This is the script download a page from the server and then search from it the required keyword | |
import urllib2 | |
def get_all_occurences(page): | |
length = len(keyword) | |
start_link = page.find(keyword) | |
if start_link == -1: | |
return None, 0 | |
end_quote = start_link + length |
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
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools | |
# Install dependencies | |
apt-get install automake libtool | |
# Fetch sources | |
git clone https://github.com/sass/libsass.git | |
git clone https://github.com/sass/sassc.git libsass/sassc | |
# Create configure script |
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
def get_all_data(datasource): | |
#print "In get_all_data" | |
#datasource = datasource.replace('\n','') | |
start = datasource.find('\\textb') | |
#import pdb; pdb.set_trace() | |
#print start | |
if start == -1: | |
return None,0 | |
st_data = datasource.find('f', start) |
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
from flask import Flask, request, session, redirect, url_for | |
import urllib | |
import requests | |
app = Flask(__name__) | |
app.secret_key = 'iwonttellyou' | |
redirect_uri = 'http://localhost:5000/callback' | |
client_id = '' # get from https://code.google.com/apis/console | |
client_secret = '' |
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
.well-inverse { | |
min-height: 20px; | |
padding: 19px; | |
margin-bottom: 20px; | |
background-color: #ffffff; | |
border: 1px solid #e3e3e3; | |
-webkit-border-radius: 4px; | |
-moz-border-radius: 4px; | |
border-radius: 4px; | |
/* -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.05); |
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
// write this snippet inside the Knockout viewModel | |
// getting all the comments from the server | |
$.getJSON("comments.php", function(commentModels) { | |
var t = $.map(commentModels.comments, function(item) { | |
return new Comment(item); | |
}); | |
self.comments(t); | |
}); |
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
// write this under Knockout viewModel | |
// This is an example to send all the users comments to the server | |
// Basic Example we can fit it for other purposes as well | |
self.save = function() { | |
return $.ajax({ | |
url: "comments.php", | |
contentType: 'application/json', | |
type: 'POST', | |
data: JSON.stringify({ |
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
# from dd/mm/yyyy to yyyy/mm/dd format of dates | |
f = open('testdate.txt') | |
i = f.read() | |
print i | |
date = i.split("\n") | |
print date | |
convDate = [] | |
for adate in date: | |
if '/' in adate: |
OlderNewer