Skip to content

Instantly share code, notes, and snippets.

var forceVersion = '5.3';
var apiVersionRegex = /docs\.unrealengine\.com\/(?<apiVersion>\d+\.\d+)\/(?<languageTag>[0-9A-Za-z\-]+)\/(?<docPath>.*)$/;
var url = document.location.href;
var match = apiVersionRegex.exec(url);
var isVersionForced = typeof forceVersion !== 'undefined' && !isNaN(parseFloat(forceVersion));
if (match !== null) {
var apiVersion = match.groups['apiVersion'];
var languageTag = match.groups['languageTag'];
var docPath = match.groups['docPath'];
if (apiVersion !== undefined && languageTag !== undefined && docPath !== undefined) {
@colin-haber
colin-haber / spohk.ps1
Last active July 29, 2021 00:40
Minimize Spotify to tray on startup by running this script on login with Task Scheduler. Just make sure that Spotify is set to run on startup and close to tray. You may need to increase the sleep time parameter on line 65 if your Spotify window opens too slowly for the script to catch.
function Set-WindowState {
<# .LINK https://gist.github.com/Nora-Ballard/11240204 #>
[CmdletBinding(DefaultParameterSetName = 'InputObject')]
param(
[Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
[Object[]] $InputObject,
[Parameter(Position = 1)]
[ValidateSet('FORCEMINIMIZE', 'HIDE', 'MAXIMIZE', 'MINIMIZE', 'RESTORE',
@colin-haber
colin-haber / sass-problem-matcher.json
Last active June 6, 2019 13:29
A Visual Studio Code problem matcher for Sass command-line errors.
"problemMatcher": {
"pattern": {
"regexp": "^\\s*(\\S+) (\\S+)(?: \\(Line (\\d+): ([^\\)]*)\\))?$",
"severity": 1,
"file": 2,
"line": 3,
"message": 4
}
}
final Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("This is an anonymous class.");
}
}
static public final Version toVersion(String s) {
final long major, minor, patch;
try {
String[] mainPart = s.split('[' + Pattern.quote(Version.PRERELEASE_PREFIX + Version.BUILD_PREFIX) + ']')[0].split(Pattern.quote(Version.VERSION_SEPARATOR));
major = Long.parseLong(mainPart[0]);
minor = Long.parseLong(mainPart[1]);
patch = Long.parseLong(mainPart[2]);
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
return null;
<article>
<p>
Hello, world! This is a piece of sample text. <em>I</em>
think it's pretty cool!
</article>
</p>
<article id="post">
<p>
Hello, world! This is a piece of sample text. <em>I</em>
think it's pretty cool!
</p>
</article>
@colin-haber
colin-haber / Colour.java
Created September 3, 2012 00:54
It's like you're installing Windows 8 all over again!
package com.n1nja.colour;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class Colour implements KeyListener{
public static void main(String[] args) {
new Colour();
}
private JFrame window;
aJToggleButton.setBackground(new Color(aJPanel.getBackground().getRed(), aJPanel.getBackground().getGreen(), aJPanel.getBackground().getBlue())); //This works.
aJToggleButton.setBackground(aJPanel.getBackground()); //This does not.
//Any ideas why? I couldn't find anything in the JavaDocs that explains it.
@colin-haber
colin-haber / Strings.java
Created June 23, 2012 05:27
A nascent collection of String utilities.
package com.n1nja.utils;
/**
* Useful classes for manipulating {@link java.lang.String String}s.
* @author Colin Haber
* @version 0.0.0
*/
public class Strings {
/**
* The default {@code char} used for padding
* {@link java.lang.String String}s.