Skip to content

Instantly share code, notes, and snippets.

@Olgagr
Olgagr / request
Created Jun 13, 2017
Request example
View request
{ fields: { name: 'Olga', country: 'Poland' },
files:
{ file:
File {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
size: 16,
path: '/var/folders/9n/3gmvwlgx6r31l_48vmlwgs000000gn/T/upload_333f3e402543bb6324609ac10cf5b28b',
View upload_file.py
def _uploadFile(self):
form = MultiPartForm()
f = None
try:
f = io.open(self.dockwidget.filePathLineEdit.text(), 'r', encoding='utf-8') # opening file
form.add_file('test', 'test.txt', f)
request = urllib2.Request('http://localhost:8080/upload')
View multipart_form.py
# -*- coding: utf-8 -*-
import itertools
import mimetools
import mimetypes
from cStringIO import StringIO
import urllib
import urllib2
View zadania.js
// Zadanie 1
var fullname = 'John Doe';
var obj = {
fullname: 'Colin Ihrig',
prop: {
fullname: 'Aurelio De Rosa',
getFullname: function() {
return this.fullname;
}
@Olgagr
Olgagr / observable_from_scratch.js
Created Aug 28, 2016
Defining observable from scratch
View observable_from_scratch.js
/**************************
Observable from scratch
***************************/
function Observable(subscribe) {
this._subscribe = subscribe;
}
Observable.prototype.subscribe = function subscribe() {
if (typeof arguments[0] === "function") {
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.1/dist/global/Rx.umd.js"></script>
<title>JS Bin</title>
</head>
<body>
@Olgagr
Olgagr / index.html
Created Aug 25, 2016 — forked from anonymous/index.html
repeat/withLatestFrom
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="mapTo">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.1/dist/global/Rx.umd.js"></script>
<title>JS Bin</title>
</head>
<body>
@Olgagr
Olgagr / index.html
Created Aug 25, 2016 — forked from anonymous/index.html
reduce/filter/do
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="mapTo">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.1/dist/global/Rx.umd.js"></script>
<title>JS Bin</title>
</head>
<body>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="mapTo">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.1/dist/global/Rx.umd.js"></script>
<title>JS Bin</title>
</head>
<body>