Skip to content

Instantly share code, notes, and snippets.

View MartinMuzatko's full-sized avatar
🐈

Martin Muzatko MartinMuzatko

🐈
View GitHub Profile
@senthilmpro
senthilmpro / download-file-axios-nodejs.js
Last active April 16, 2024 11:16
Download File using axios : Node.js program
'use strict'
const Fs = require('fs')
const Path = require('path')
const Axios = require('axios')
async function downloadImage () {
const url = 'https://unsplash.com/photos/AaEQmoufHLk/download?force=true'
const path = Path.resolve(__dirname, 'images', 'code1.jpg')
@jaytaylor
jaytaylor / delete-from-v2-docker-registry.md
Last active March 18, 2024 15:07
One liner for deleting images from a v2 docker registry

One liner for deleting images from a v2 docker registry

Just plug in your own values for registry and repo/image name.

registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
    curl -sSL -I \
        -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
@eirikb
eirikb / load-vue-components-from-folder.js
Created May 24, 2017 19:24
Load all Vue components from a given folder, no need for an "index.js"-file
const req = require.context('./components/', true, /\.(js|vue)$/i);
req.keys().map(key => {
const name = key.match(/\w+/)[0];
return Vue.component(name, req(key))
});
@MartinMuzatko
MartinMuzatko / webcam.js
Created November 17, 2016 15:17
WebRTC Instant Webcam
navigator.mediaDevices.getUserMedia({audio:0,video:1})
.then(function(mediaStream) {
document.body.innerHTML='<video>'
var video = document.querySelector('video')
video.srcObject = mediaStream
video.onloadedmetadata = function(e) {
video.play()
}
})
@dypsilon
dypsilon / reader.js
Last active September 12, 2022 23:37
Example usage of the reader monad.
/**
* This short program will encrypt the user password
* and insert a new record into a mock database.
*/
const Reader = require('fantasy-readers');
const R = require('ramda');
const crypto = require('crypto');
// our mock database
const database = [
@davatron5000
davatron5000 / the-state-of-element-container-queries.md
Last active August 23, 2023 15:43
The State of Element/Container Queries

The State of Container Queries

tl;dr Developers would like the idea to style components based on a parent's width rather than depend solely on the viewport media query. This would allow modular components to style themselves while being agnostic to the viewport.

There is currently a lot of developer interest in getting a feature like Container Queries (née "Element Queryies") shipped in a browser.

2-min Catchup

Here are official'ish documents to outline the developer community's desires.

@odan
odan / xampp_php7_xdebug.md
Last active April 17, 2024 05:36
Installing Xdebug for XAMPP
@aradnom
aradnom / riotjs-router.js
Created July 15, 2015 05:43
First attempt at a simple router in Riot.js.
// Create new observable for watching route changes
var Router = riot.observable();
// Process routes on both route change and initial load
riot.route( processRoute );
riot.route.exec( processRoute );
// Expose the Router object
riot.mixin( 'Router', Router );
@bendrucker
bendrucker / test.js
Created October 1, 2014 09:52
Truncate data during tests with knex
'use strict';
var Promise = require('bluebird');
var knex = require('../../src/db').knex;
var tables = [
'organizations',
'campaigns',
'donors',
'pledges',