This file contains hidden or 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
# | |
# Example from code built on the Flask web framework (and Werkzeug) | |
# Accepts uploading a photo file in the 'photo' form member, then | |
# copies it into a memory byte array and converts it to a numpy array | |
# which in turn can be decoded by OpenCV. | |
# | |
# Beware that this increases the memory pressure and you should | |
# configure a max request size before doing so. | |
# | |
# It saves a round-trip to a temporary file, though. |
This file contains hidden or 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
class Api::UploadsController < ApiController | |
def create | |
@upload = Upload.new(upload_params) | |
ensure | |
clean_tempfile | |
end | |
private |
This file contains hidden or 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
require 'httparty' | |
subdomain='FAKE' | |
api_token='FAKE' | |
id='FAKE' | |
endpoint="https://#{subdomain}.pagerduty.com/api/v1/escalation_policies/#{id}" | |
token_string="Token token=#{api_token}" | |
data= { | |
name: "New name" |
This file contains hidden or 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
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
This file contains hidden or 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 lang="en"> | |
<head> | |
<meta name="description" content="Webpage description goes here" /> | |
<meta charset="utf-8"> | |
<title>Change_me</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="author" content=""> | |
<link rel="stylesheet" href="css/style.css"> |
This file contains hidden or 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
public function sendData(url:String, vars:URLVariables) | |
{ | |
var req:URLRequest = new URLRequest(url); | |
req.data = vars; | |
req.method = URLRequestMethod.POST; | |
var loader:URLLoader = new URLLoader(); | |
loader.dataFormat = URLLoaderDataFormat.TEXT; // URLLoaderDataFormat.VARIABLES will cause error #2101 | |
loader.load(req); | |
loader.addEventListener(Event.COMPLETE, loadComplete, false, 0, true); |