Skip to content

Instantly share code, notes, and snippets.

View ValentinFunk's full-sized avatar
👋

Valentin ValentinFunk

👋
  • InnoVint, Inc
  • Tarifa, Spain
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ValentinFunk
ValentinFunk / sh_playermodel_list.lua
Created December 3, 2017 15:14
Playermodel Lua. Put this into garrysmod/lua/autorun/sh_playermodel_list.lua
AddCSLuaFile()
--[[
Follow this template to add playermodels to the picker and make the hands work.
You need to make sure that the playermodels are downloaded on the client as well (i.e. FastDL or Workshop Download).
This is the template:
player_manager.AddValidModel( "<name>", "<player model path>" )
player_manager.AddValidHands( "<name>", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" )
]]--
@ValentinFunk
ValentinFunk / NetlifyServerPushPlugin.js
Last active May 4, 2024 04:24
Webpack - Generate Netlify HTTP2 Server Push _headers File when using the HtmlWebpackPlugin
/**
* Generate a Netlify HTTP2 Server Push configuration.
*
* Options:
* - headersFile {string} path to the _headers file that should be generated (relative to your output dir)
*/
function NetlifyServerPushPlugin(options) {
this.options = options;
}
@ValentinFunk
ValentinFunk / sh2_uart_hal.cpp
Created August 30, 2023 08:22
SHTP BOM085 UART HAL port attemt
#include <stdio.h>
#include <string.h>
#include "sh2_uart_hal.hpp"
#include "sh2_hal.h"
#include "sh2_err.h"
#include "driver/uart.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
@ValentinFunk
ValentinFunk / fixes.md
Created March 4, 2023 12:09
Angular 15 upgrade issues and solutions

Solutions to Angular 15 upgrade issues

I'm documenting upgrade issues and solutions to them in case someone else runs into the same issue.

Module parse failed: Duplicate export 'renderModule'

This is because of angular/angular-cli#23866, the migration somehow didn't fix it for me.

To fix the issue go into your main.server.ts file and remove the line that exports from '@angular/platform-server'.

You can also search for '@angular/platform-server' in files and remove the line that looks like this:

@ValentinFunk
ValentinFunk / README.md
Created January 18, 2019 09:58
Fixes SVG Gradients for Safari by changing fill URLs to the current pathname. Also fixes xlink:href URLs.

Snippet to fix SVG issues in Angular (2+) with Safari, Firefox and Chrome

This listens to Angular route changes and on route change does the following:

  1. Replaces the link in <use xlink:href="#some-id"></use> by a path prefixed version
  2. Replaces the fill property in referenced SVGs by a path prefixed version
  3. Replaces the style in <svg style="fill: url(#gradient)"> with a prefixed version

Adapted from Gist by Leon Derijke

# Creates Structures TypeInfo / TypeInfoData
def initStructures():
strucId = GetStrucIdByName("TypeInfo")
if (strucId == BADADDR):
strucIdInfoData = AddStrucEx(-1, "TypeInfoData", 0)
AddStrucMember(strucIdInfoData, "m_name", -1, (FF_QWRD|FF_DATA|FF_0CHAR), ASCSTR_C, 8)
ApplyType(GetMemberId(strucIdInfoData, 0), ParseType("char*", 0))
strucId = AddStrucEx(-1, "TypeInfo", 0)
AddStrucMember(strucId, "m_infoData", -1, (FF_QWRD|FF_DATA|FF_0STRO), 0, 8)
/*
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
@ValentinFunk
ValentinFunk / undiscriminate.ts
Created March 3, 2020 15:48
Undiscriminiate in Typescript
type DiscriminateMessageType<
A,
T extends BookingMessageNotification['bookingMessageType']
> = A extends BookingMessageNotification ?
T extends A['bookingMessageType'] ? A : never
: never;
asMsg<T extends BookingMessageNotification['bookingMessageType']>(type: T): DiscriminateMessageType<BookingMessageNotification, T> {
return this._entry as any;