Skip to content

Instantly share code, notes, and snippets.

View Werninator's full-sized avatar
👀

Patrick Werner Werninator

👀
  • Germany
View GitHub Profile
@Werninator
Werninator / gradient-me.js
Last active May 31, 2016 16:06
gradientMe() - uses jQuery + ColorThief
(function($) {
$.fn.gradientMe = function(opacity) {
if (typeof opacity == 'undefined')
opacity = 0.2;
if (typeof ColorThief != 'function') {
console.log('gradientMe(): ColorThief.js is missing!');
return;
@Werninator
Werninator / 01_zipAndDownload.php
Last active January 16, 2017 09:30
[php] dynamically create files and let it download as a zip file
<?php
function zipAndDownload($zipName, $contents) {
$archive = new ZipArchive();
touch($zipName);
if ($archive->open($zipName, ZIPARCHIVE::OVERWRITE) !== true)
return;
<?php
$urlBeginning = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http') . '://';
$url = $urlBeginning . $_SERVER['HTTP_HOST'] . '/';
@Werninator
Werninator / advertisement.js
Created May 8, 2017 11:13
How to spot adblock
// in case this file gets loaded, it sets the variable to false
adBlocked = false;
@Werninator
Werninator / scrHandleTimers.gml
Created May 26, 2017 21:04
Game Maker Language Snippets
var i, timer;
if !is_array(timers)
return false;
for (i = 0; i < array_height_2d(timers); i++) {
if timers[i, 0] == -1
continue;
@Werninator
Werninator / embed.html
Created July 4, 2017 13:52
embedding pdfs
<!-- Contents can't be accessed (might be good for pdf stuff) -->
<object data="abc.pdf" type="application/pdf">
<!-- Alternative content when Object can't be loaded (coz of older browsers): HTML5 <embed>, contents can be manipulated -->
<embed src="abc.pdf" type="application/pdf" />
</object>
@Werninator
Werninator / resize-window.gd
Last active August 22, 2017 18:02
Godot: centers the game window
# https://godotengine.org/qa/485/how-to-center-game-window
var screen_size = OS.get_screen_size()
var window_size = OS.get_window_size()
func _ready():
OS.set_window_position(screen_size * .5 - window_size * .5)
@Werninator
Werninator / AssocArrayToXmlParser.php
Last active September 15, 2017 11:58
[php] A basic little helper to convert assoc arrays to xml
<?php
class AssocArrayToXmlParser
{
private $assocArray;
private $xmlVersion = '1.0';
private $encoding = 'utf-8';
function __construct(array $_assocArray = null)
{
@Werninator
Werninator / onion-boy.md
Last active September 26, 2017 15:02
SPOOKYFISTPUMPSPOOKYFISTPUMPSPOOKYFISTPUMPSPOOKYFISTPUMPSPOOKYFISTPUMPSPOOKYFISTPUMPSPOOKYFISTPUMPSPOOKYFISTPUMP

onion boy

a game about onion boy

general idea

onion boy is an onion with arms and legs with a huge nose

his goal is to find eyes so he can happily cry because of himself

@Werninator
Werninator / system.xml
Created October 27, 2017 09:54
(Magento 1.9.x) access file upload from the settings
<!--
Warning: simplified, check out
https://www.kathirvel.com/adding-file-uploads-to-magento-admin-system-configuration/
-->
<config>
<sections>
<TAB_NAME>
<groups>
<GROUP_NAME>
<fields>