Skip to content

Instantly share code, notes, and snippets.

View Werninator's full-sized avatar
👀

Patrick Werner Werninator

👀
  • Germany
View GitHub Profile
@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 / 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;
<?php
$urlBeginning = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http') . '://';
$url = $urlBeginning . $_SERVER['HTTP_HOST'] . '/';
@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;
@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 / excel-fileupload.html
Created September 15, 2016 15:12
Native HTML File-Upload only accepting Excel-Files
<!-- Straight from http://stackoverflow.com/questions/11832930/html-input-file-accept-attribute-file-type-csv -->
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
@Werninator
Werninator / giphy-reactions.txt
Last active May 19, 2016 08:15
giphy reactions for slack
/giphy spooky fist pump
/giphy bacon burger reaction
/giphy let your pussy go
/giphy lolwut stunned what shocked huh
/giphy dance faggot dance
/giphy doge dance halloween
@Werninator
Werninator / ngrChange.js
Last active May 31, 2016 16:04
ngrChange - ng REAL change - only trigger change on value change at pressing enter or blur out.
app.directive('ngrChange', function() {
return {
require: 'ngModel',
link: function (scope, element, attrs) {
var valueBefore = element.val();
element.bind('focus', function() {
if (valueBefore !== element.val())
valueBefore = element.val();
});
@Werninator
Werninator / ngEnter.js
Last active March 3, 2016 14:51 — forked from EpokK/ngEnter.js
ngEnter directive for AngularJS
app.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind('keydown keypress', function(event) {
if (event.which !== 13)
return;
scope.$apply(function() {
scope.$eval(attrs.ngEnter);
});
@Werninator
Werninator / my-sublime-text-config.json
Last active March 21, 2016 15:01
my sublime text configuration
{
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"draw_minimap_border": true,
"draw_white_space": "all",
"font_face": "SourceCodePro-Regular",
"font_size": 11,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":