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
/* Cannot use $.bind() since jQuery does not normalize native events. */ | |
$('#dropzone').get(0).addEventListener('drop', upload, false); | |
function upload(event) { | |
var data = event.dataTransfer; | |
var boundary = '------multipartformboundary' + (new Date).getTime(); | |
var dashdash = '--'; | |
var crlf = '\r\n'; |
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
// http://www.solidbg.com/beta/app.js | |
var file = document.getElementById('file'), | |
canvas = document.getElementById('canvas'), | |
preview = document.getElementById('preview'), | |
ctx = canvas.getContext('2d'), | |
ua = navigator.userAgent.toLowerCase(), | |
isMobileSafari = (ua.indexOf('mobile') > -1 && ua.indexOf('safari') > -1); | |
file.onchange = readFile; |
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
#!/usr/bin/env python | |
# http://www.vnsecurity.net/t/length-extension-attack/ | |
# sha1 padding/length extension attack | |
# by rd@vnsecurity.net | |
# | |
import sys | |
import base64 | |
from shaext import shaext |
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
// See https://github.com/rack/rack/blob/master/lib/rack/session/cookie.rb | |
1.9.3p194 :096 > data = "BAh7CiINdHJhY2tpbmd7CCIUSFRUUF9VU0VSX0FHRU5UIi02OTA2YTkyNDY5 | |
1.9.3p194 :097"> OGY3MTBjODk2MDc5MmJhNTE5ZWEyODVlY2JlZDg2IhlIVFRQX0FDQ0VQVF9F | |
1.9.3p194 :098"> TkNPRElORyItYTBiZmM4NzZkNjhmZTdhZWE3MDBkYTVlYTg5MjVhYmFjNmYy | |
1.9.3p194 :099"> Zjc5NCIZSFRUUF9BQ0NFUFRfTEFOR1VBR0UiLWRkMDY1ZWQyNjNjNjdkNzk5 | |
1.9.3p194 :100"> Zjk0M2FiNmMzOWI1NWM1ZTAwOGNiYjUiCWNzcmYiRTU3ZTM0MDI0YWJhNGIw | |
1.9.3p194 :101"> YzVhOTM0ODJjZGIzMzEwZWYxNTUzNTFjMjIyMjRiNDEwODdmOTAxNjJjYzgx | |
1.9.3p194 :102"> MDdkMWIiCXVzZXIiDXBoaWxmcmVvIg9jc3JmLnRva2VuIjEzOWRRampaV0s3 | |
1.9.3p194 :103"> VDRyNFZOZFRaSEJ2dXB2Q0V2dGxsZkdJYnpNQzlXbDFzPSIPc2Vzc2lvbl9p |
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
import thread | |
import sys | |
import socket | |
import time | |
HOST = '' | |
PORT = 50004 | |
if 1: | |
# local |
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
// directly uploads to S3 | |
// See http://philfreo.com/blog/how-to-allow-direct-file-uploads-from-javascript-to-amazon-s3-signed-by-python/ | |
// See https://github.com/elasticsales/s3upload-coffee-javascript | |
editors.Filepicker = editors.Text.extend({ | |
tagName: 'div', | |
events: { | |
'change input[type=file]': 'uploadFile', |
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
// like 'Select' editor, but will always return a boolean (true or false) | |
editors.BooleanSelect = editors.Select.extend({ | |
initialize: function(options) { | |
options.schema.options = [ | |
{ val: '1', label: 'Yes' }, | |
{ val: '', label: 'No' } | |
]; | |
editors.Select.prototype.initialize.call(this, options); | |
}, | |
getValue: function() { |
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
/* vim: set tabstop=2 shiftwidth=2 softtabstop=2: */ | |
define([ | |
'backbone', | |
'backbone-forms' | |
], | |
function(Backbone) { | |
var Form = Backbone.Form, |
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 logging.handlers import SMTPHandler | |
class DetailedSMTPHandler(SMTPHandler): | |
def __init__(self, app_name, *args, **kwargs): | |
self.app_name = app_name | |
return super(DetailedSMTPHandler, self).__init__(*args, **kwargs) | |
def getSubject(self, record): | |
from flask import request | |
from socket import gethostname |
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
module("Faking response data", { | |
setup: function () { | |
var testData = { foo: 'bar', name: 'phil' }; | |
this.server = sinon.fakeServer.create(); | |
this.server.respondWith("GET", "/api/testmodel/1", [200, { "Content-Type": "application/json" }, JSON.stringify(testData)]); | |
}, | |
teardown: function () { | |
this.server.restore(); | |
} | |
}); |