Skip to content

Instantly share code, notes, and snippets.

View victorjonsson's full-sized avatar
🎯
Focusing

Victor Jonsson victorjonsson

🎯
Focusing
View GitHub Profile
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

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.
@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 -->
<!-- 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 -->
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
<?php
/**
*
* @example
* <?php
*
* class Day extends EnumeratedType
* {
* const MONDAY = 'Monday';
<?php
namespace Routing\Auth;
abstract class AuthChecker {
const SKIPPED;
const SUCCESS;
const AUTHENTICATION_FAILED;
const AUTHORIZATION_FAILED;
@victorjonsson
victorjonsson / fsm.php
Last active November 11, 2016 15:22
fsm.php
<?php
interface State {
public function getState();
}
abstract class StateAbstract implements State {
const STATE_INIT = 'STATE_INIT';
@victorjonsson
victorjonsson / statement-validator.js
Last active May 11, 2017 10:28
statement-validator.js
$.formUtils.addValidator({
name: 'statement',
validatorFunction : function(value, $elem, conf, language, $form, eventContext) {
var statementIsValid = true,
$resultTree = $('<result><node></node></result>'),
$current = $resultTree.children().eq(0),
invokeNext = true;
$.each(value.replace(/\s+/g,' ').split(' '), function (i, str) {
if (str == '||') {
invokeNext = true;
// Controller exempel
public class AccountController : Controller
{
public async Task<IActionResult> kollaStatusPåBankIdInloggningen(string reference) {
// ... massa saker händer...
AuthResult result = authClient.AuthorizeReference(...)