Skip to content

Instantly share code, notes, and snippets.

View ajinabraham's full-sized avatar

Ajin Abraham ajinabraham

View GitHub Profile
import re, urllib
PAT = re.compile(ur'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))')
for line in urllib.urlopen("http://daringfireball.net/misc/2010/07/url-matching-regex-test-data.text"):
print [ mgroups[0] for mgroups in PAT.findall(line) ]
@ajinabraham
ajinabraham / load.js
Created June 28, 2014 09:01
Load JavaScript Dynamically and Invoke something onLoad
function require(file,callback){
var head=document.getElementsByTagName("head")[0];
var script=document.createElement('script');
script.src=file;
script.type='text/javascript';
//real browsers
script.onload=callback;
//Internet explorer
script.onreadystatechange = function() {
@ajinabraham
ajinabraham / HTTP_GET_Listner.vb
Created June 25, 2014 13:14
HTTP Listner for URL Grabbing
Private Sub ProcessRequests()
If Not System.Net.HttpListener.IsSupported Then
Exit Sub
End If
Dim listener As System.Net.HttpListener = _
New System.Net.HttpListener()
listener.Prefixes.Add("http://*:8998/")
listener.Start()
/**
* A Javascript object to encode and/or decode html characters using HTML or Numeric entities that handles double or partial encoding
* Author: R Reid
* source: http://www.strictly-software.com/htmlencode
* Licences: GPL, The MIT License (MIT)
* Copyright: (c) 2011 Robert Reid - Strictly-Software.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABI