Skip to content

Instantly share code, notes, and snippets.

View vishnu-prasad-r's full-sized avatar

Vishnuprasad R vishnu-prasad-r

View GitHub Profile
@vishnu-prasad-r
vishnu-prasad-r / upload2facebook
Created October 3, 2015 01:14 — forked from nseo/upload2facebook
A sample code to upload an image file to facebook using Facebook javascript sdk
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Hello FB</title>
</head>
<body>
<div id="fb-root"></div>
<div id="fb-content"></div>
<div>
@vishnu-prasad-r
vishnu-prasad-r / localstorage.js
Created January 28, 2014 01:58
Javascript snippet to use HTML5 localStorage easily. Supports storing any kind of data. Handles commonly occuring exceptions like localStorage quota being exceeded and browser not supporting localStorage. .
/*Javascript snippet to use HTML5 localStorage easily.
Properly handles situation like 'localStorage not being supported by the browser' and excedding localSorage quota.
Supports storing any kind of data */
/*key should be String, value can be any Javascript object */
function writeToLocalStorage(key,value)
{
if(typeof(Storage) == 'undefined')
{
@vishnu-prasad-r
vishnu-prasad-r / html_sanitizer.py
Last active January 3, 2016 13:49
Richtext HTML Sanitizer for Django. Many developers find it necessary to allow some HTML on form fields, especially on a RichTextField like TinyMCE or CKEditor. Django's strip_tags function does a good job removing dangerous tags when you can white-list the allowed tags. But it doesn't do anything about preventing XSS attacks using event attribu…
# Usage:
# import html_sanitizer
# safe_html = html_sanitizer.secure_html( raw_html_string)
import tidy
import re