When uploading multiple files, the $_FILES
variable is created in the form:
Array
(
[name] => Array
(
[0] => foo.txt
import Layer from 'express/lib/router/layer'; | |
const Promise = global.Promise; | |
/** | |
* "fixt" express mbt promises. Als een stukje middleware een promise returnt dan moeten errors eigenlijk aan next worden gegeven. | |
* | |
* We hadden ook de suffix `Async` kunnen gebruiken om naast de bestaande functies nieuwe te maken. Dat heeft een flink nadeel | |
* omdat de api op verschillende manieren te benaderen is. | |
*/ |
/* | |
* node-ws - pure Javascript WebSockets server | |
* Copyright Bradley Wright <brad@intranation.com> | |
*/ | |
// Use strict compilation rules - we're not animals | |
'use strict'; | |
var net = require('net'), | |
crypto = require('crypto'); |
/** | |
* A mixin which helps you to add depth to elements according to the Google Material Design spec: | |
* http://www.google.com/design/spec/layout/layout-principles.html#layout-principles-dimensionality | |
* | |
* Please note that the values given in the specification cannot be used as is. To create the same visual experience | |
* the blur parameter has to be doubled. | |
* | |
* Adapted from a LESS version at https://medium.com/@Florian/freebie-google-material-design-shadow-helper-2a0501295a2d | |
* | |
* Original Author: Florian Kutschera (@gefangenimnetz), Conceptboard GmbH (@conceptboardapp) |
var app = angular.module('app', ['firebase']); | |
app.controller('ctrl', function($scope, $pageArray) { | |
$scope.pageItems = $pageArray(ref, 'number'); | |
}); | |
app.factory('$pageArray', function($firebaseArray) { | |
return function(ref, field) { | |
// create a Paginate reference | |
var pageRef = new Firebase.util.Paginate(ref, field, {maxCacheSize: 250}); |
const flattenTco = ([first, ...rest], accumulator) => | |
(first === undefined) | |
? accumulator | |
: (Array.isArray(first)) | |
? flattenTco([...first, ...rest]) | |
: flattenTco(rest, accumulator.concat(first)) | |
const flatten = (n) => flattenTco(n, []); | |
console.log(flatten([[1,[2,[[3]]]],4,[5,[[[6]]]]])) |
import PropTypes from 'prop-types'; | |
import React, { Component } from 'react'; | |
import { StripeProvider } from 'react-stripe-elements'; | |
export default class AsyncStripeProvider extends Component { | |
static propTypes = { | |
apiKey: PropTypes.string.isRequired | |
}; | |
// constructor |
function scrollTo (element, duration) { | |
if (!element) { | |
return | |
} | |
var target = element.scrollHeight | |
target = Math.round(target) | |
duration = Math.round(duration) | |
if (duration < 0) { | |
return false | |
} |
(function($) { | |
$.postJSON = function(url, data, success, dataType) { | |
if (typeof data != 'string') { | |
data = JSON.stringify(data); | |
} | |
$.ajax({ | |
url : url, | |
type: "post", | |
data: data, | |
dataType: dataType || "json", |