Skip to content

Instantly share code, notes, and snippets.

View nhh's full-sized avatar
🏠
Working from home

Niklas nhh

🏠
Working from home
View GitHub Profile
@nhh
nhh / gist:0ab1bbd1988cceb256aa27abdadee3ca
Last active February 15, 2024 09:58
Spotify web player songtext scraper
function updateStatus(status) {
const options = {
suggestedName: 'Spotify Song Texte',
types: [
{
description: 'Text Files',
accept: {
'text/plain': ['.txt'],
},
},
@nhh
nhh / seo-cheat-sheet.md
Created November 24, 2022 13:56 — forked from meysius/seo-cheat-sheet.md
SEO CHEATSHEET

URLS

  • The more specific the better -> buy-slippers better than shopping
  • Seperate keywords -> baseball-games better than baseballgames
  • Heyphen better than underscore
  • Use keywords dont over do this
  • Use extension .html

Title TAGS

@nhh
nhh / m2m.cs
Last active November 6, 2020 10:30
ManyToMany
// These are the entities which have "files".
// Attaching a file or removing one, really just happens by using the attribute ICollection<File> GeometryReports for example.
// Every resulting database action will be performed automatically by entity framework. There is no additional Entity, Context or Service method needed.
// For each of these Relations, which hold several files, there must be a join table created.
// But this can silently happen in a Migration and DOES NOT have any impact on the code. (no entites and so on)
// Removing a File from its holding list will NOT
// I repeat: WILL NOT physically remove the <File> entity from disk, it will ONLY detach and delete the entry from the join table.
$(document).ready(function() {
$("#liga3-quota-slider").lightSlider({
item: 11,
autoWidth: true,
slideMove: 1, // slidemove will be 1 if loop is true
slideMargin: 0,
addClass: '',
mode: "slide",
useCSS: true,
### Keybase proof
I hereby claim:
* I am nhh on github.
* I am nhh (https://keybase.io/nhh) on keybase.
* I have a public key ASC2OkXOH2F6ufnlaWqrooOnuKhpnx4-EGsvCdSL1gJKogo
To claim this, I am signing this object:
HttpClient httpClient = HttpClient.newBuilder().executor(executor).build();
Builder webSocketBuilder = httpClient.newWebSocketBuilder();
WebSocket webSocket = webSocketBuilder.buildAsync(URI.create("wss://echo.websocket.org"), new WebSocket.Listener() {
@Override
public void onOpen(WebSocket webSocket) {
logger.info("CONNECTED");
webSocket.sendText("This is a message", true);
Listener.super.onOpen(webSocket);
}
@Override
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="720" prefWidth="1280" fx:controller="dev.nhh.echoclient.controller.LayoutController" xmlns:fx="http://javafx.com/fxml" stylesheets="@layout.css">
<children>
<!-- Top Menu -->
<fx:include GridPane.rowIndex="0" source="/menu/menu.fxml"></fx:include>
public class Server implements Runnable {
private DatagramSocket socket;
private boolean running;
@Override
public void run() {
running = true;
try {
@nhh
nhh / log.ts
Created July 26, 2018 06:58
Typescript method decorator
export default function log(targetObject: Object, targetMethodName: string | symbol, targetMethod: TypedPropertyDescriptor<Function>) {
return {
value: function( ... args: any[]) {
if(targetMethod.value) {
const result = targetMethod.value.apply(targetObject, args);
return result + 1;
}
}
}
}