Skip to content

Instantly share code, notes, and snippets.

$countryCodes = array(
array (
'country_code' => 'AF',
'phone_code' => '93',
),
array (
'country_code' => 'AX',
'phone_code' => '35818',
),
array (
@bubach
bubach / gist:11178452
Last active August 29, 2015 14:00
force local login with iframe and JS magic
<script type="text/javascript">
var loadedOnce = 0;
function portalenIframeLoad() {
if (loadedOnce == 0) {
loadedOnce = 1;
} else {
window.location.href = "https://www.elevcentralen.se/";
}
}
</script>
@bubach
bubach / tinymvc_pdo.php
Created May 19, 2014 08:16
TinyMVC PDO Class
<?php
/***
* Name: TinyMVC
* About: An MVC application framework for PHP
* Copyright: (C) 2007-2008 Monte Ohrt, All rights reserved.
* Author: Monte Ohrt, monte [at] ohrt [dot] com
* License: LGPL, see included license file
***/
<?php
/*
*
* CBL ActiveRecord - an O/R mapping library for PHP5
* Copyright (C) 2005 Cybozu Labs, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@bubach
bubach / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
self::timer('wmvc_app_start'); // set named start points
self::ram('wmvc_app_start');
//...
/**
* timer
*
* get/set timer values
@bubach
bubach / gist:84de88ebb85495d53df7
Last active August 29, 2015 14:07
Pure magic
<?php
/**
* main method of execution
*
* @access public
*/
public function run() {
// minimum to load rest
$this->setupAutoload();
@bubach
bubach / gist:efaba77548812c89921a
Created December 19, 2014 02:33
Tampermonkey -- Video Adblock Deluxe
// ==UserScript==
// @name Video Adblock Deluxe
// @version 0.1
// @description Will substitute ad videos
// @match http://*.tv3play.se/*
// @match http://*.kanal5play.se/*
// @match http://*.tv6play.se/*
// @match http://*.tv10play.se/*
// @grant
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
{"video_id":514677,"emediate":{"emediate_identifier":null},"ab_allowed":false,"freewheel":{"assetId":"mtgx-play.514677","serverUrl":"http:\/\/5d3e9.v.fwmrm.net","networkId":"381929","siteSectionId":"tv3play_flash","profile":"381929:MTG_Play_Flash_Live","show_preroll":true,"show_postroll":true,"cuepoints":{"midroll":[701,1611,2420,3669,4702]}},"ad_calls":[{"time":0,"url":"http:\/\/5d3e9.v.fwmrm.net\/ad\/g\/1?nw=381929&resp=vast2&crtp=vast2s&prof=381929%3AMTG_Play_Flash_Live&csid=tv3play_flash&caid=mtgx-play.514677&vdur=5459&pvm=%7Bpvm%7D&vpm=%7Bvpm%7D&flag=%2Bsltp&vdty=exact;;slid=1&tpcl=PREROLL&tpos=0&ptgt=a&maxd=100","type":"preroll"},{"time":701,"url":"http:\/\/5d3e9.v.fwmrm.net\/ad\/g\/1?nw=381929&resp=vast2&crtp=vast2s&prof=381929%3AMTG_Play_Flash_Live&csid=tv3play_flash&caid=mtgx-play.514677&vdur=5459&pvm=%7Bpvm%7D&vpm=%7Bvpm%7D&flag=%2Bsltp&vdty=exact;;slid=1&tpcl=MIDROLL&tpos=701&ptgt=a&maxd=250&cpsq=1","type":"midroll"},{"time":1611,"url":"http:\/\/5d3e9.v.fwmrm.net\/ad\/g\/1?nw=381929&resp=vast2&crtp
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>