Skip to content

Instantly share code, notes, and snippets.

var fd = new FormData(),
image = <data_to_post>;
fd.append('file', image);//upload file urlData
var xhr = new XMLHttpRequest();
//register upload progress event listener
xhr.upload.addEventListener("progress", function (event) {
//uploadProgress(event, fileIndex);
}, false);
@dmitryevseev
dmitryevseev / validate-date-directive-spec.js
Created September 23, 2013 16:52
Example of testing directive
define(['angular-mocks', 'app/directives/validate-date-directive', 'app/directives/passengers'], function () {
describe('validate-date directive', function () {
var scope, compile, compileAndDigest, elm,
inputHtml = '<input name="date" validate-date="date" ng-model="date">';
beforeEach(function () {
module('hubskip.directives');
inject(function ($rootScope, $compile) {
scope = $rootScope;
@dmitryevseev
dmitryevseev / Gruntfile.js
Last active December 28, 2015 02:29
Reproduces conditions for grunt-ng-config to throw: Warning: An error occurred while processing a template (Cannot read property 'js' of undefined).
module.exports = function (grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
src: [
'source/js/**/*.js',
@dmitryevseev
dmitryevseev / coolfile.html
Created January 13, 2014 11:38
File upload with drag&drop and FormData
<label id="image_container">Upload image:
<div id="image_dropzone"
class="dropzone"
dropzone="copy file:image/png file:image/gif file:image/jpeg file:image/jpg file:image/jpe file:image/ico file:image/icon file:text/ico file:application/ico file:image/x-icon file:image/tiff file:image/tif file:image/x-windows-bmp file:image/bmp">
<h3>Click to select image files<br>or just drop files here</h3>
<input type="file" id="image_fileInput" name="UploadForm[image]">
</div>
</label>
/*\
|*|
|*| :: cookies.js ::
|*|
|*| A complete cookies reader/writer framework with full unicode support.
|*|
|*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie
|*|
|*| This framework is released under the GNU Public License, version 3 or later.
|*| http://www.gnu.org/licenses/gpl-3.0-standalone.html

Keybase proof

I hereby claim:

  • I am dmitryevseev on github.
  • I am devseev (https://keybase.io/devseev) on keybase.
  • I have a public key ASBhRrFewAg2HRdHyFOryLbJQvCYbR758CNPZjGGmQciWgo

To claim this, I am signing this object:

<?xml version="1.0" encoding="UTF-8"?>
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" entityID="https://test.my.company.com" validUntil="2024-08-13T07:37:40.675Z">
<md:IDPSSODescriptor WantAuthnRequestsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>MIICNDCCAZ2gAwIBAgIBADANBgkqhkiG9w0BAQ0FADA3MQswCQYDVQQGEwJ1czEMMAoGA1UECAwDYWJjMQwwCgYDVQQKDANhYmMxDDAKBgNVBAMMA2FiYzAeFw0yMDAzMjQwNzM5MDdaFw0yMTAzMjQwNzM5MDdaMDcxCzAJBgNVBAYTAnVzMQwwCgYDVQQIDANhYmMxDDAKBgNVBAoMA2FiYzEMMAoGA1UEAwwDYWJjMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC45Sng2oqISVroen20uxcySTfJl2VsxYESLS/W17JZm4qyIowyCYPqQfYT1IaasxUeWISQ8/uYaudEM/dQyB05kcWCXGvyEewRYngwIc4fV5QX5nOBIHktDcbCN5XXmrAkgltyhUJUeo0KySxWkec9LnnMWoA+wAoAj7c2MZ9QeQIDAQABo1AwTjAdBgNVHQ4EFgQU/3TdR/sqCvProvDns1ej179wiAQwHwYDVR0jBBgwFoAU/3TdR/sqCvProvDns1ej179wiAQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQ0FAAOBgQCCAQ5l