Skip to content

Instantly share code, notes, and snippets.

View nkonev's full-sized avatar

Nikita Konev nkonev

View GitHub Profile
@nkonev
nkonev / readme.md
Created November 11, 2022 12:03 — forked from slava-vishnyakov/readme.md
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@nkonev
nkonev / gist:289e7150b7f26bc31515191310b3e305
Created May 18, 2022 10:21 — forked from folkengine/gist:3781429
Spring EL Placeholder to get Host Name
<!-- Used in the Jasig/Cas uniqueIdGenerators.xml file -->
<!-- http://static.springsource.org/spring/docs/3.1.1.RELEASE/spring-framework-reference/html/expressions.html -->
<bean id="ticketGrantingTicketUniqueIdGenerator" class="org.jasig.cas.util.DefaultUniqueTicketIdGenerator">
<constructor-arg
index="0"
type="int"
value="50" />
<constructor-arg
index="1" value="#{ T(java.net.InetAddress).getLocalHost().getHostName() }" />
</bean>
@nkonev
nkonev / PECS.java
Created October 26, 2021 15:13
PECS.java
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
// https://habr.com/ru/post/559268/
class Class0 { }
class Class1 extends Class0 { }
@nkonev
nkonev / checkpoint.sh
Created October 25, 2021 14:18 — forked from bubenkoff/checkpoint.sh
Endpoint Security VPN FULL start/stop script for Mac OS X
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
#
# Usage: ./checkpoint.sh
#
# The script checks if Enpoint Security VPN is running. If it is, then it shuts it down, if it is not, it fires it up.
# Or, make an Automator action and paste the script.
https://habr.com/ru/post/347752/
https://stackoverflow.com/questions/61266792/when-to-set-proxybeanmethods-to-false-in-springs-configuration
https://stackoverflow.com/questions/3423972/spring-transaction-method-call-by-the-method-within-the-same-class-does-not-wo
http://sevenlist.github.io/2014/08/24/spring-at-transactional-with-aspectj/
https://habr.com/ru/post/347752/
https://stackoverflow.com/a/58502122

git

source /usr/local/Cellar/git/2.29.1/etc/bash_completion.d/git-completion.bash

brew

https://docs.brew.sh/Shell-Completion

if type brew &>/dev/null; then
 HOMEBREW_PREFIX="$(brew --prefix)"
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
class HeaderableWrapper extends HttpServletRequestWrapper {
final HttpHeaders httpHeaders;
boolean removeParts = false;
/**
* Constructs a request object wrapping the given request.
*
* @param request The request to wrap
@nkonev
nkonev / static.js
Last active December 17, 2019 07:59
static.js
var path = require('path');
var http = require('http');
var fs = require('fs');
var port = process.argv[2] || 3001;
var resDir = process.argv[3] || __dirname;
var contextPath = process.argv[4] || ''; // /dump
resDir = path.resolve(resDir);