jq is useful utility, but I use it infrequently and each time I have to check what was the filters syntax. This cheat sheet helps we to recall what is the expression that I need. Hopefully it would help others too. For full guide refer to the official jq manual.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.foreign.Arena; | |
import java.lang.foreign.FunctionDescriptor; | |
import java.lang.foreign.Linker; | |
import java.lang.foreign.SymbolLookup; | |
import java.lang.foreign.ValueLayout; | |
import java.lang.invoke.MethodHandle; | |
public class HelloWorld { | |
public static void main(String[] args) throws Throwable { | |
// Arena handles the lifecycle of native memory segments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
using UnityEngine.UIElements; | |
// The static constructor is called before the class is used, | |
// but there is no guarantee when this would happen. | |
// InitializeOnLoad ensures that it is called when Unity loads | |
// or when the scripts are reloading. | |
[InitializeOnLoad] | |
public class WelcomeWindow : EditorWindow |
GitHub recently added support for including Mermaid diagrams in Markdown files. The good news is that it works for AsciiDoc files as well. Here is an example:
sequenceDiagram
participant Alice
participant Bob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Git hook that checks if an issue was linked to the commit. | |
# If not, adds default issue reference and marks the commit as draft. | |
ISSUE_KEYWORD='JIRA' | |
DEFAULT_ISSUE='NA' | |
DRAFT_KEYWORD='DRAFT' | |
# File containing the commit message is passed as first argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.server | |
import logging | |
import socketserver | |
logging.basicConfig(filename='messages.log', format='%(levelname)s:%(asctime)s:%(message)s', level=logging.DEBUG) | |
class SimpleLoggingHandler(http.server.BaseHTTPRequestHandler): | |
def do_POST(self): | |
msg = self.rfile.read(int(self.headers['Content-Length'])).decode('UTF-8') | |
logging.info(msg) |
На упражненията стана въпрос за String.Join
и реализирахме нещо подобно.
Интересно е да видим изходния код на метода, написан от Miscrosoft 😄
public static String Join(String separator, params Object[] values) {
if (values==null)
throw new ArgumentNullException("values");
Contract.EndContractBlock();
if (values.Length == 0 || values[0] == null)