Skip to content

Instantly share code, notes, and snippets.

View resistancecanyon's full-sized avatar

Jithu Thomas resistancecanyon

View GitHub Profile
@resistancecanyon
resistancecanyon / multipleImageContentReader.js
Last active May 7, 2024 15:48
Reading Multiple Image Base64 data using Es6 Async/Await in a html:type:file input
// html
// <input type="file" onchange="imagesSelected" multiple accept=".gif,.jpg,.jpeg,.png" />
async function imagesSelected(event) {
let files = [...event.target.files];
let images = await Promise.all(files.map(f=>{return readAsDataURL(f)}));
//all images' base64encoded data will be available as array in images
}
function readAsDataURL(file) {
@resistancecanyon
resistancecanyon / 01.ts
Last active April 30, 2018 14:40 — forked from jhades/01.ts
Angular auxillary Routes
export const routeConfig:Routes = [
{
path: 'home',
component: Home
},
{
path: 'lessons',
component: AllLessons
}
];
@resistancecanyon
resistancecanyon / apache benchmark usage all
Last active September 27, 2016 06:50 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
<!DOCTYPE html>
<html lang="en">
<head>
<style>
@keyframes blink {
0% { color: white;background-color:white }
50% { color: white;background-color:green }
100% { color: white; background-color:green }