This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$client = new Google_Client(); | |
$client->setAuthConfig('client_secret.json'); | |
$client->setAccessType("offline"); // offline access | |
$client->setIncludeGrantedScopes(true); // incremental auth | |
$client->addScope(Google_Service_Drive::DRIVE_METADATA_READONLY); | |
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/oauth/index.php'); | |
$auth_url = $client->createAuthUrl(); ?> | |
<button onclick="window.location.href = '<?= $auth_url ?>' ">login</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (open) { | |
XMLHttpRequest.prototype.open = function (method, url, async, user, pass) { | |
this.addEventListener("readystatechange", function () { | |
let state = this.readyState; | |
console.log(this); | |
if (this.readyState === 4) { | |
//here you go | |
} | |
}, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function time2string($timestamp){ | |
$now = new DateTime(date('Y-m-d H:i:m.s')); | |
$searched = new DateTime(date('Y-m-d H:i:m.s', $timestamp)); | |
$diff = $searched->diff($now); | |
if($diff->y > 0){ | |
if($diff->y === 1){ | |
return 'vor einem Jahr'; | |
} else { | |
return 'vor ' . $diff->y . ' Jahren'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ifModule mod_gzip.c> | |
mod_gzip_on Yes | |
mod_gzip_dechunk Yes | |
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ | |
mod_gzip_item_include handler ^cgi-script$ | |
mod_gzip_item_include mime ^text/.* | |
mod_gzip_item_include mime ^application/x-javascript.* | |
mod_gzip_item_exclude mime ^image/.* | |
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* | |
</ifModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function swipeEvents(){ | |
// patch CustomEvent to allow constructor creation (IE/Chrome) - resolved once initCustomEvent no longer exists | |
if ('initCustomEvent' in document.createEvent('CustomEvent')) { | |
window.CustomEvent = function (event, params) { | |
params = params || { bubbles: false, cancelable: false, detail: undefined }; | |
let evt = document.createEvent('CustomEvent'); | |
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# thumbor imaging service | |
# https://github.com/thumbor/thumbor/wiki | |
#guetzli compression for thumbor | |
#https://gist.github.com/honsa/bf972693bc1452d42acc1d87d0ce18e1 | |
# Licensed under the MIT license: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Countdown Clock</h1> | |
<div id="clockdiv"> | |
<div> | |
<span class="days"></span> | |
<div class="smalltext">Days</div> | |
</div> | |
<div> | |
<span class="hours"></span> | |
<div class="smalltext">Hours</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let element = document.querySelector('.element'); | |
observer = new IntersectionObserver(callback); | |
observer.observe(element); | |
function callback(entry, observer){ | |
if(entry[0].isIntersecting){ | |
console.log(entry[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementsByTagName('button')[0].onclick = function () { | |
scrollTo(document.body, 0, 1250); | |
} | |
function scrollTo(element, to, duration) { | |
var start = element.scrollTop, | |
change = to - start, | |
currentTime = 0, | |
increment = 20; | |