Skip to content

Instantly share code, notes, and snippets.

View jensendarren's full-sized avatar

Darren Jensen jensendarren

View GitHub Profile
@patrikbego
patrikbego / native-node-file-upload.js
Last active June 23, 2023 16:38
Native / pure / no-npm file upload REST API
/**
* This is native /pure /no-npm node.js file uploader.
*
* CLIENT FUNCTION: export function uploadFile(file) {
* fetch("http://localhost:8080/sys/upload", {
* method: 'POST',
* headers: { "Content-Type": "multipart/form-data;"},
* body: file }).then(response => response.json()
* ).then(
* success => console.log(success)
@mottalrd
mottalrd / event_sourcing_intro.rb
Last active November 2, 2023 21:47
An introduction to event sourcing, London Ruby User Group, 9th May 2018
module Commands
module Meeting
AcceptSchema = Dry::Validation.Schema do
required(:user_id).filled
required(:status).value(eql?: :scheduled)
end
class Accept < Command
def call
return validate if validate.failure?
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@ceme
ceme / bash_curl_loop
Last active January 19, 2023 13:07
bash curl loop
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n\n'$(date);done