Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View thomaslarsson's full-sized avatar

Thomas Maurstad Larsson thomaslarsson

View GitHub Profile

Keybase proof

I hereby claim:

  • I am thomaslarsson on github.
  • I am larsson (https://keybase.io/larsson) on keybase.
  • I have a public key ASCVEg9ncMxNBP8Og4IVYg__y8pupOMmcMW6bsI8HkPx1Qo

To claim this, I am signing this object:

@thomaslarsson
thomaslarsson / purgeOldTrash
Last active August 29, 2015 14:23
place in extension/x/bin/php/purgeOldCache.php. Change dir to ezpublish_legacy and run using $ php extension/x/bin/php/purgeOldCache.php.
<?php
require_once('autoload.php');
// Configuration
$removeOlderThanDays = 90;
$siteaccess = "admin_siteaccess";
// CLI initialization.
$cli = eZCLI::instance();
<?php
namespace NM\Bundle\GoogleProductsBundle\API;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
use eZ\Publish\API\Repository\Values\Content\Query;
use eZ\Publish\Core\MVC\Legacy\Kernel as LegacyKernel;
use eZContentObjectTreeNode;
/**
* Class eZProductSearchService
@thomaslarsson
thomaslarsson / mapper.php
Created October 23, 2014 12:51
Google shop mapper
...
use eZ\Publish\Core\MVC\Legacy\Kernel as LegacyKernel;
use \eZURI;
class GoogleApiMapperService {
/** @var eZLegacyKernel */
protected $legacyKernel;
@thomaslarsson
thomaslarsson / thai.php
Created October 9, 2014 14:21
Thai logic
<?php
interface Same {
const SAME_BUT_DIFFERENT = "yes";
const SAME = "yes";
public function same($same);
}
class Thailand implements Same
@thomaslarsson
thomaslarsson / functions_posting.php
Created April 2, 2014 17:57
Funksjon for dumping av tråder
/**
* Handle topic bumping
* @param int $forum_id The ID of the forum the topic is being bumped belongs to
* @param int $topic_id The ID of the topic is being bumping
* @param array $post_data Passes some topic parameters:
* - 'topic_title'
* - 'topic_last_post_id'
* - 'topic_last_poster_id'
* - 'topic_last_post_subject'
* - 'topic_last_poster_name'
<?php
// Make sure direct access is not allowed
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Allows you to calculate the remainder of time from now to a given DateTime
*
* @author Thomas Maurstad Larsson, Logoz As <thomas@logoz.no>
* @link http://nybilguiden.no
@thomaslarsson
thomaslarsson / maps
Last active December 19, 2015 10:09
Simple google maps helper
<?php
/**
* Simple Google maps address lookup
*
* Enables you to get latitude and longitude for an address
*
* @author Thomas Maurstad Larsson, Logoz As <thomas@logoz.no>
* @link http://logoz.no
* @copyright Copyright (c) 2012
@thomaslarsson
thomaslarsson / user.php
Created August 11, 2012 03:43
Library_User
<?php
/**
* Library_User
* User class providing authentication
*
* @package Core
* @author Thomas Larsson <thomas@juvenorge.com>
* @copyright (c)2012, Thomas Larsson
*
@thomaslarsson
thomaslarsson / return.php
Created August 11, 2012 00:39
Return values
<?php
$array = array
(
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
"String 1", "Hello", 'World'
);
foreach ( $array as $value )
{