Skip to content

Instantly share code, notes, and snippets.

View victorjonsson's full-sized avatar
🎯
Focusing

Victor Jonsson victorjonsson

🎯
Focusing
View GitHub Profile
<?php
namespace Routing\Auth;
abstract class AuthChecker {
const SKIPPED;
const SUCCESS;
const AUTHENTICATION_FAILED;
const AUTHORIZATION_FAILED;
<?php
/**
*
* @example
* <?php
*
* class Day extends EnumeratedType
* {
* const MONDAY = 'Monday';
window.addEventListener("load", function() {
var self = window.self,
parent = window.parent,
setTransparentBackground = function(doc) {
doc.getElementsByTagName('html')[0].style.background = 'transparent';
doc.getElementsByTagName('body')[0].style.background = 'transparent';
};
// make current doc transparent
<!-- Start natverkstagg Tidningsnatet -->
<img src="http://sifomedia.tidningsnatet.se/1/tidningsnatet/123645@TopRight?XE&amp;Sajt=<?php echo $oas_site_page ?>&amp;Sektion=<?php echo $section ?>&amp;Grupp1=tidningsnatet&amp;Grupp2=umewebb&amp;Grupp3=NorrgruppenWebb&amp;XE" alt="" />
<!-- Slut natverkstagg Tidningsnatet -->
@victorjonsson
victorjonsson / sifo-tagg-bara-i-mobilen
Created October 23, 2014 16:14
sifo-tagg-bara-i-mobilen.html
<!-- SIFO mobile specific tracking -->
<script type='text/javascript' src='http://mmetrix.mobi/sifo_msr.js'></script>
<script type="text/javascript">
sifo_Msr("<?php echo VKWP_SIFO_CPID ?>", "", "<?php echo rawurlencode( $subsection1 ); ?>", "", "", "", "");
</script>
<noscript>
<p><img src="http://bh.mobiletech.no/sifo/img?cpid=<?php echo VKWP_SIFO_CPID ?>&amp;cat=<?php echo rawurlencode( $subsection1 ); ?>&amp;REF=" alt="" height="1" width="1" /></p>
</noscript>
<!-- /SIFO mobile specific tracking -->

PayGate

WordPress + Varnish + External Login Service

This plugin makes the following assumptions about the login service:

  • The login service uses JWT
  • The signature in the user cookie provided by the login service contains an array of products that the user owns.
  • The user cookie provided by the login service contains a user ID, this id is also present in the cookie signature.
  • The login service has a javascript API.
Usage: python generator.py [<flags>]
Options:
-h, --help show this help message and exit
--template=TEMPLATE File to use as template [index.mustache]
--file=FILE Name of the generated file [index.html]
--pages=PAGES Directory where the pages are located [pages]
-w, --watch Start monitoring file changes and generate the one-page
html file on the fly
@victorjonsson
victorjonsson / arlima-inline-articles.php
Created February 27, 2014 08:14
arlima, inline-articles
<?php
$current_renderer = false;
// Always catch which renderer that is at work
add_action('arlima_list_begin', function($renderer) use($current_renderer) {
$current_renderer = $renderer;
});
// Move "children" into "inline-children" and create their template object
<script>
setWallPaperAd('URL-till-bild', 'URL-man-klickar', '#000000');
</script>
@victorjonsson
victorjonsson / gist:6728599
Last active December 24, 2015 02:09
Tail -f but with PHP in a browser
<?php
error_reporting(E_ALL);
$file = '/var/log/fpm/fpm-php.log';
echo '<h5>'.$file.'</h5>';
$offset = filesize($file) - 80240;
if( $offset < 0 )
$offset = 0;