Skip to content

Instantly share code, notes, and snippets.

package com.jarv.colorprinter
/**
*
* Valid parameters:
*
* Colors:
* "BLACK", "RED", "GREEN", "YELLOW", "BLUE", "PURPLE", "CYAN", "WHITE"
* Only the last color parameter will be used
*
@j4rv
j4rv / VersionStringComparator.java
Last active February 7, 2018 09:43
Version Strings Comparator for Java
import java.util.Comparator;
/**
* Both arguments need to be version Strings, formatted like "7.5.3", "2.3" "8.0.0.42"...
*
* If a version has more number length, it could be considered newer. Examples:
* "2.5" vs "2.5.1" -> a is older -> Negative int returned
* "2.6" vs "2.5.1" -> a is newer -> Positive int returned
* "2.5" vs "2.5.0" -> equal -> Zero returned
*
@j4rv
j4rv / ServiceLocator.cs
Last active October 25, 2024 21:38
Unity Service Locator Component
using System.Collections.Generic;
using UnityEngine;
public class ServiceLocator : MonoBehaviour {
private Dictionary<System.Type,Object> cache = new Dictionary<System.Type,Object>();
private static ServiceLocator _singleton;
private static ServiceLocator singleton {
get {
@j4rv
j4rv / .Comment Draft README.
Last active September 18, 2019 10:38
Comment Drafts (ScriptRunner for JIRA)
Create a Script Fragment that calls the above JS code with the context "jira.view.issue".
import java.awt.Robot
import java.awt.event.InputEvent
/*
CLICK LIKE CRA-ZY
*/
def sleepAmount = 200
def clicks = 1000
using UnityEngine;
public class LazyngletonBehaviour<T> : MonoBehaviour where T : LazyngletonBehaviour<T> {
private static T _instance;
public static T Instance {
get{
if(_instance == null){
GameObject newInstance = new GameObject();
_instance = newInstance.AddComponent<T>();
import os
from pathlib import Path
textToSearch = "LinkJiraIssue"
# Busca los archivos llamados atlassian-plugin.xml desde el directorio activo (incluyendo directorios hijos)
xmls = list(Path(".").rglob("atlassian-plugin.xml"))
for r in xmls:
f = open(r, "r")
@RunWith(Parameterized.class)
public class CalculatorTest {
enum Type {SUBSTRACT, ADD};
@Parameters
public static Collection<Object[]> data(){
return Arrays.asList(new Object[][] {
{Type.SUBSTRACT, 3.0, 2.0, 1.0},
{Type.ADD, 23.0, 5.0, 28.0}
});
}
package main
import (
"fmt"
"time"
"github.com/fatih/color"
)
var startTime = time.Hour * 8
@j4rv
j4rv / README.md
Last active July 21, 2020 11:05
Confluence user macros

My collection of useful Confluence user macros