Skip to content

Instantly share code, notes, and snippets.

Avatar
👊

Patrick Werner Werninator

👊
View GitHub Profile
View gist:f49c96d04f1a63b2e7ac905ba07577a3
You ask yourself why an orc would look like an onion.
"Why did you do that?"
"Peeling off my skin makes me cry."
"Oh. I'm sorry."
"Are you going to kill me?"
"I don't know."
The orc's eyes well up. "Peeling off my skin makes me cry."
"I can't kill you. I'm not an orc. But I can make you better."
You take out a flintlock pistol and shoot the orc in the head.
> You victory dance.
View Grabber.cpp
// Copyright Patrick Werner 2019
#include "Grabber.h"
#include "Engine/World.h"
#include "GameFramework/PlayerController.h"
#include "Components/PrimitiveComponent.h"
#define OUT
// Sets default values for this component's properties
@Werninator
Werninator / foo.vue
Created Oct 28, 2019
reset view component state
View foo.vue
<template lang="pug">
p {{ bar }}
</template>
<script>
export default {
name: 'Foo',
data() {
return {
bar: 'baz',
@Werninator
Werninator / php_detect_eol.php
Last active Oct 3, 2020
[php] detect EOL type from string
View php_detect_eol.php
<?php
/**
* Detects the end-of-line character of a string.
* modified version from https://stackoverflow.com/questions/11066857/detect-eol-type-using-php
* @param string $str The string to check.
* @param string $default Default EOL (if not detected).
* @return string The detected EOL, or default one.
*/
function detectEol($str, $default = PHP_EOL) {
View composer install oneliner.sh
curl -sS https://getcomposer.org/installer | php
@Werninator
Werninator / csv-to-assoc.php
Created Sep 12, 2018
csv with semicolons to assoc array
View csv-to-assoc.php
<?php
// modified version of https://steindom.com/articles/shortest-php-code-convert-csv-associative-array
function str_getcsv_semicolons($input) {
return str_getcsv($input, ';');
}
$rows = array_map('str_getcsv_semicolons', file($filedir));
$header = array_shift($rows);
@Werninator
Werninator / login-popup.js
Created Jul 31, 2018
sweetalert2 login box
View login-popup.js
// it's in german but you can translate it if you want to
import swal from "sweetalert2";
import axios from "axios";
const loginPopup = () => {
swal({
title: "Login",
backdrop: false,
showCancelButton: true,
@Werninator
Werninator / dsgvo.txt
Last active Aug 7, 2018
WP contactform 7 DSGVO Acceptance checkbox
View dsgvo.txt
[acceptance dsgvo] Ich habe die <a href="/blog.php/datenschutz/" target="_blank">Datenschutzerklärung</a> gelesen und akzeptiert*
[acceptance dsgvo] I have read and accepted the <a href="/blog.php/datenschutz/" target="_blank">data security declaration</a>*
[acceptance dsgvo] J'ai lu et accepté la <a href="/blog.php/datenschutz/" target="_blank">politique de confidentialité</a>*
[acceptance dsgvo] Ho letto e accettato <a href="/blog.php/datenschutz/" target="_blank">l'informativa sulla privacy</a>*
@Werninator
Werninator / recursive_grep.txt
Last active Jun 28, 2018
unix: search for string recursively
View recursive_grep.txt
grep -rnw . -e 'waldo'
find . -name 'waldo.txt'