Skip to content

Instantly share code, notes, and snippets.

View shapeshifta78's full-sized avatar
💜
fiddling

Thomas Horster shapeshifta78

💜
fiddling
View GitHub Profile
@shapeshifta78
shapeshifta78 / tabid.js
Created April 12, 2022 09:32
Create tabid
import uuidv4 from "uuid/v4";
class CurrentTab {
/**
* create a new tabid or grab it from storage
*
* @constructor
*/
constructor() {
this.debug = DEVELOPMENT;
@shapeshifta78
shapeshifta78 / ReportingHelper.js
Last active March 11, 2022 15:45
Codeceptjs allure and reportportal helper - adds videos to reports
const fs = require('fs');
const log = require('simple-node-logger').createSimpleLogger({});
const { container, Helper } = require('codeceptjs');
const allureCLI = require('allure-commandline');
/**
* this plugin will add videos of failed tests generated by Playwright to the allure and reportportal reports
*/
class ReportingHelper extends Helper {
async _attachVideo(test) {
let view;
const viewporter = {};
const html = document.documentElement;
viewporter.getView = () => {
try {
view = window
.getComputedStyle(html, ":after")
.getPropertyValue("content")
.replace(/["']/g, "");
@shapeshifta78
shapeshifta78 / debounce.js
Created November 8, 2017 17:39 — forked from tcase360/debounce.js
Debounce function in ES6
const debounce = (fn, time) => {
let timeout;
return function() {
const functionCall = () => fn.apply(this, arguments);
clearTimeout(timeout);
timeout = setTimeout(functionCall, time);
}
}
/**
* @module fullscreen helper
* @description detection and handling of fullscreen capabilities
* @returns {Object}
*/
export default {
/**
* Returns vendor prefixed fullscreenchange event
* @returns String
*/
@shapeshifta78
shapeshifta78 / gource.sh
Created March 15, 2017 16:47 — forked from XueshiQiao/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@shapeshifta78
shapeshifta78 / maffay.js
Last active August 30, 2017 08:48
SPON Maffayisiert
// ==UserScript==
// @name SPON Maffayisiert
// @namespace peter
// @include http://www.spiegel.de/*
// @downloadURL https://gist.github.com/shapeshifta78/1f164172e5c4c13542ab
// @version 1
// @grant none
// @run-at document-idle
// ==/UserScript==
window.setTimeout(function () {
@shapeshifta78
shapeshifta78 / gist:9d9cb943259a23c4b3d1
Last active August 29, 2015 14:13
disable back button
(function (w) {
w.location.hash = '#no-back';
var historyApi = (typeof w.history.pushState !== 'undefined');
if (w.location.hash == '#no-back') {
if (historyApi) {
w.history.pushState(null, '', '#stay');
} else {
w.location.hash = '#stay';
@shapeshifta78
shapeshifta78 / jqueryui-mobile-slider.js
Last active December 23, 2015 00:09
Simulate mouseevents for jqueryui slider on mobile devices
$('#slider').on('touchstart touchmove touchend', 'a.ui-slider-handle', function (event) {
//mousevents to simulate on touch
var touchEvents = {
touchstart: 'mousedown',
touchmove: 'mousemove',
touchend: 'mouseup'
};
//get element and type of event to simulate
var simulatedEvent = touchEvents[event.originalEvent.type],
<?php
$url = $_GET['url'];
$allowedurls = array(
'http://developer.yahoo.com',
'http://icant.co.uk'
);
if(in_array($url,$allowedurls)){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);