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
uploadMethod: 'PUT', | |
uploadAdded: function(file, item) { | |
//Recieve the signed PUT request here | |
//I can create another GIST if anyone would like the code for signing the requests | |
mydropzone.options.url = url; | |
}, | |
uploadSending: function(file, formData, xhr) { | |
xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream'); |
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 generate_signed_url(mime, file_name, s3): | |
""" | |
:param mime str: The file mime type. | |
:param file_name str: The name of the file to be upload into s3. | |
:param s3 Object: An object containing the bucket name and access keys to amazon. | |
:return str: The signed url. | |
""" | |
expires = int(time.time() + 10) | |
amz_headers = 'x-amz-acl:private' |
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
var fs = require('fs') | |
var util = require('util') | |
var express = require('express'); | |
var serveIndex = require('serve-index'); | |
var querystring = require('querystring'); | |
var app = express(); | |
app.use(serveIndex(__dirname, { | |
'icons': true |
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 crc16 | |
from redis import Redis | |
TOTAL_HASH_SLOTS = 16384 | |
#TODO | |
SHARDED_COMMANDS = [ | |
'get', | |
'set', |
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
@web.stream_request_body | |
class UploadHandler(RequestHandler): | |
def prepare(self): | |
self.count = 0 | |
self.buffer_len = 0 | |
self.buffer = StringIO() | |
self.mp = bucket.initiate_multipart_upload('Multiparts are cool') | |
def data_received(self, data): |
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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:5414b12e5613456d6b81de472be9f5d902c5ef090fa39aad4abc1864f95ad48c" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
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 IPython.core.magic import Magics, magics_class, line_magic | |
import asyncio | |
@magics_class | |
class AsyncMagics(Magics): | |
@line_magic | |
def await(self, line): | |
return asyncio.get_event_loop().run_until_complete(eval(line, self.shell.user_global_ns, self.shell.user_ns)) |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myComponent: 'will-destroy-element', | |
appName: 'Ember Twiddle', | |
actions: { | |
click() { | |
if (this.get('myComponent') !== null) | |
this.set('myComponent', null); | |
else |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>jQuery Experimenter Interface</title> | |
</head> | |
<body> | |
<select id="exp"></select> | |
<select id="session"></select> |
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
function regexRange(lo, hi) { | |
let re = []; | |
hi = hi.toString(); | |
lo = lo.toString(); | |
while (hi.length > lo.length) { | |
re.push(hi.split('').reduce((acc, c) => acc + `[${acc.length === 0 ? 1 : 0}-${c}]`, '')); | |
hi = '9'.repeat(hi.length - 1); | |
} | |
let i = 0; | |
re.push(lo.split('').reduce((acc, c) => acc + `[${c}-${hi[i++]||c}]`, '')); |
OlderNewer