Skip to content

Instantly share code, notes, and snippets.

View undeadcat's full-sized avatar

Maxim Kropotov undeadcat

View GitHub Profile
@undeadcat
undeadcat / jedis-junit.java
Created December 6, 2022 01:15
Jedis multi-slot-pipeline test
package redis.clients.jedis;
import org.junit.Assert;
import org.junit.Test;
import redis.clients.jedis.providers.ClusterConnectionProvider;
import java.util.Collections;
import java.util.HashSet;
public class ClusterPipeliningTest {
@undeadcat
undeadcat / bolt-campaigns-server.xml
Created October 23, 2019 14:43
Code style settings for Bolt-server/campaigns to match guidelines
<code_scheme name="bolt-server" version="173">
<TypeScriptCodeStyleSettings version="0">
<option name="FIELD_PREFIX" value="" />
<option name="FILE_NAME_STYLE" value="PASCAL_CASE" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="USE_PUBLIC_MODIFIER" value="true" />
<option name="SPACES_WITHIN_OBJECT_TYPE_BRACES" value="false" />
</TypeScriptCodeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="RIGHT_MARGIN" value="120" />
@undeadcat
undeadcat / cucumber_tests.patch
Last active December 12, 2018 11:53
Tests example: something works, but errors are wrongly reported
Index: plugins/CucumberJavaScript/testData/execution/SimplePassed/features/step_definitions/stepDef.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- plugins/CucumberJavaScript/testData/execution/SimplePassed/features/step_definitions/stepDef.js (date 1544612688000)
+++ plugins/CucumberJavaScript/testData/execution/SimplePassed/features/step_definitions/stepDef.js (date 1544612688000)
@@ -0,0 +1,14 @@
+var {defineSupportCode} = require('cucumber');
+
@undeadcat
undeadcat / withProps.xml
Created March 29, 2018 15:07
Intellij IDEA with styled-components: add injection for 'withProps' function
<LanguageInjectionConfiguration>
<injection language="LESS" injector-id="js">
<display-name>styled-components withProps</display-name>
<prefix>div {</prefix>
<suffix>}</suffix>
<place><![CDATA[stringTemplate().withParent(taggedTemplate(jsExpression().withChild(jsReferenceExpression().withNameStartingWith("withProps"))))]]></place>
</injection>
</LanguageInjectionConfiguration>
@undeadcat
undeadcat / styled-jsx-inject.patch
Created November 7, 2017 11:56
Intellij IDEA: Add css injection in <style></style> JSX tags
Index: src/test/InjectionTest.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/test/InjectionTest.kt (revision 964b6e55da872b69a7609487eaa8e9a02af1c515)
+++ src/test/InjectionTest.kt (date 1510053653000)
@@ -132,9 +132,28 @@
"div {color:EXTERNAL_FRAGMENT}")
}
@undeadcat
undeadcat / unsound.ts
Created September 23, 2017 00:03
TypeScript is unsound
class Base {
}
class Derived extends Base {
y:string
}
//pretend we have variance
class Collection1<T>{
accept(value: T) { }
package com.intellij.StyledComponents
import com.intellij.lang.javascript.psi.JSFile
import com.intellij.psi.PsiElement
import com.intellij.psi.css.CssElementDescriptorProvider
import com.intellij.psi.css.CssPropertyDescriptor
import com.intellij.psi.css.CssSimpleSelector
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil
class MyCssElementDescriptorProvider : CssElementDescriptorProvider() {
/**
* @returns {{foo:number, bar:number}}
*/
function returnsFoobar() {
}
/**
@param p {number}
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Web.Compilation;
namespace WebApp
{
public class Generator
{
@undeadcat
undeadcat / nginx.grok
Last active November 16, 2015 01:02
nginx grok pattern
%{TIMESTAMP_ISO8601:log_timestamp}\t%{NOTSPACE:msec}\t%{NOTSPACE:host}\t%{WORD:request_method}\t%{NOTSPACE:path}\t%{NOTSPACE:querystring}\t%{NOTSPACE:referer}\t%{IPORHOST:remote_addr}\t(?<user_agent>[^\t]*?)\t%{NOTSPACE:cookie_sid}\t%{NUMBER:status_code}\t%{NUMBER:request_time:float}\t%{NUMBER:request_length:int}\t%{NOTSPACE:asp_net_sessionid}\t%{NOTSPACE:cookie_token}\t%{NOTSPACE:upstream_address}\t%{NUMBER:bytes_sent:int}\t%{NOTSPACE:upstream_response_time:float}