Skip to content

Instantly share code, notes, and snippets.

View redochka's full-sized avatar

reda redochka

View GitHub Profile
@LongLiveCHIEF
LongLiveCHIEF / README.md
Last active April 13, 2023 12:25
Run node, npm, npx, yarn as container

Developing with Node, without installing node!

Note: currently only works on *nix systems (until a powershell script can be created)

With the technique below, you can run node, npm, npx, or yarn commands as if the programs were installed natively on your system, and you won't even know the difference! This includes any ports that your app or dev process will start up and use for development, as well as compatibility with persistent npm config --global cli usage.

See more in the Usage section below.

@robotdan
robotdan / OAuth1AuthorizationHeaderBuilder.java
Last active August 6, 2023 08:41
OAuth v1 Authorization Builder
/*
* Copyright (c) 2019, FusionAuth, All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@msievers
msievers / [Spring, JMH] Howto integrate JMH benchmarks with Spring.md
Last active March 23, 2024 21:12
[Spring, JMH] Howto integrate JMH benchmarks with Spring

Motivation

Integrate JMH (Java Microbenchmarking Harness) with Spring (Boot) and make developing and running benchmarks as easy and convinent as writing tests.

Idea

Wrap the necessary JMH boilerplate code within JUnit to benefit from all the existing test infrastructure Spring (Boot) provides. It should be as easy and convinent to write benchmarks as it is to write tests.

TL;DR;

@joyrexus
joyrexus / README.md
Last active June 8, 2023 07:45
form-data vs -urlencoded

Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded and multipart/form-data.

“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data. Otherwise, use application/x-www-form-urlencoded.”


Matt Bridges' answer in full:

The MIME types you mention are the two Content-Type headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing

@jugyo
jugyo / file_name_on_status_bar.py
Created February 26, 2013 07:41
Sublime Text Plugin to show file name on status bar
import sublime_plugin
class FileNameOnStatusBar(sublime_plugin.EventListener):
def on_activated(self, view):
path = view.file_name()
if path:
for folder in view.window().folders():
path = path.replace(folder + '/', '', 1)
view.set_status('file_name', path)
else: