Skip to content

Instantly share code, notes, and snippets.

@kkbalu
kkbalu / app.component.ts
Created January 23, 2019 11:55 — forked from chaman-1/app.component.ts
How to upload multiple files without starting their upload parallely, I want to implement synchronous upload, when one file gets uploaded the next file starts uploading
file: FileList; //populated on filechange
uploadURI: Array < String >; //populated after filechange
public Tus() {
if (this.file.length > 0 && this.uploadURI.length > 0) {
this.uploadService.tusUpload(this.file, this.uploadURI);
}
} else {
alert('file length error');
}
@kkbalu
kkbalu / app.component.ts
Created January 23, 2019 11:55 — forked from chaman-1/app.component.ts
Compress images in Angular recursively using rxJS
import { Component } from '@angular/core';
import { map, expand } from 'rxjs/operators';
import { EMPTY } from 'rxjs';
import { CompressorService } from './compressor.service';
@Component({
selector: 'app-root',
template: '<input type="file" (change)="process($event)" multiple/>',
styles: ['']
})
@kkbalu
kkbalu / upload.component.ts
Created January 23, 2019 11:54 — forked from chaman-1/upload.component.ts
Vimeo video uploader using tus js client
//Filename: upload.component.ts
import { Component, OnInit } from '@angular/core';
import { UploadService } from '../upload.service';
import { map, expand } from 'rxjs/operators';
import { EMPTY } from 'rxjs';
export class uploadFiles {
constructor(public video: File, public path: string, public uploadURI: string) {
this.video = video;
this.path = path;
@kkbalu
kkbalu / glass.css
Created December 12, 2018 12:20 — forked from gjhilton/glass.css
Glass CSS
.glass{
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0)));
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
border: 2px solid #DDDBD7;
-webkit-box-shadow: 3px 3px 10px rgba(0,0,0,0.4), inset 0 0 10px rgba(255,255,255, 0.8);
-moz-box-shadow: 3px 3px 10px rgba(0,0,0,0.4), inset 0 0 10px rgba(255,255,255, 0.8);
@kkbalu
kkbalu / base64-image-upload.js
Created July 6, 2018 09:08 — forked from madhums/base64-image-upload.js
save base64 encoded image
/*
* Taken from http://stackoverflow.com/questions/5867534/how-to-save-canvas-data-to-file/5971674#5971674
*/
var fs = require('fs');
// string generated by canvas.toDataURL()
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0"
+ "NAAAAKElEQVQ4jWNgYGD4Twzu6FhFFGYYNXDUwGFpIAk2E4dHDRw1cDgaCAASFOffhEIO"
+ "3gAAAABJRU5ErkJggg==";
// strip off the data: url prefix to get just the base64-encoded bytes