Skip to content

Instantly share code, notes, and snippets.

@MarkBaker
MarkBaker / Talk-Option-Summaries.txt
Last active June 4, 2019 08:21
Talk Option Summaries
Title:
Deploying straight to Production: A Scientist approach with Experiments
Summary:
Deploying directly to production and testing in live can be scary, especially when your business can’t afford to lose any of
its traffic; but having a staging environment isn’t always an option, and with the right approach, the risks of deploying
straight to production can be mitigated.
Home Page
Today’s tech, tomorrow’s mindset, yesterday’s problems. => Todays tech, tomorrows mindset, yesterdays problems.
(no apostrophes)
You ideate, validate and prototype. => You bring the ideas,
Unsure exactly what you're saying here
on fluffy clouds
??? in the cloud?
Company
@MarkBaker
MarkBaker / PHPSpreadsheetCalculationTest.md
Last active May 17, 2022 21:55
The following code can be used to submit an issue with the PHPSpreadsheet calculation engine
<?php

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;

error_reporting(E_ALL);
set_time_limit(0);

date_default_timezone_set('UTC');
<?php
class evidenceController {
public function getDetails($id){
$course = Course::with(['courseType'])
->checkEstablishmentOnView()
->excludeArchived()
->findOrFail($id);
$view = View::make('courses/parts/details')
->with('course', $course);
@MarkBaker
MarkBaker / anonymousFactory.php
Created January 29, 2016 09:49
Dynamic Instantiation of a class with optional Traits
<?php
class baseClass {
protected $a;
protected $b;
public function __construct($a, $b = null) {
$this->a = $a;
$this->b = $b;
}
Verifying that +markbaker is my blockchain ID. https://onename.com/markbaker
@MarkBaker
MarkBaker / gpxTracker.md
Last active August 29, 2015 14:27
Cat-Tracker - A PHP Generator-based Reader for reading GPX trackpoint files

This is a simple reader class for gpx files retrieved from the G-Paws Cat Tracker that allows you to loop over the trackpoints read from that file, returning lat/lon as attributes of a simple stdClass object as the returned "key" from the Reader, and ele/time as attributes of a simple stdClass object as the returned "value"

The Reader class

class gpxReader
{

    public function __construct($fileName)
    {
@MarkBaker
MarkBaker / UK Postcode Parse
Last active August 29, 2015 14:06
UK Postcode Parsing
function parsePostcode2($postcode) {
$postcode = preg_replace('/\s*/','',strtoupper($postcode));
$sector = substr($postcode,0,-2);
$outcode = $district = substr($sector,0,-1);
list($area) = sscanf($district,'%[A-Z]');
$incode = substr($postcode,-3);
return array(
@MarkBaker
MarkBaker / PHPExcel PHPNW13 Hackathon Objectives.md
Last active December 22, 2015 21:49
Objectives for the PHPNW13 Hackathon

For the Open Source PHPExcel library (https://github.com/PHPOffice/PHPExcel):

  • Autodetect separator, enclosure and line endings for CSV Reader

    An autodetect option that will identify the separator (e.g. comma, semicolon, pipe, tab, etc), the enclosure (e.g. quote, double quote), enclosure escape character (e.g. "" or ") and line endings for csv files, and set them up for the CSV reader.

  • Helper Wizards for number format masks

@MarkBaker
MarkBaker / Duplicate Keys in Array
Created July 20, 2013 23:33
Using PHP 5.5 Generators to simulate an array with duplicate keys
function duplicateKeys($string) {
$string = strtolower($string);
$length = strlen($string);
for ($i = 0; $i < $length; ++$i) {
yield ord(strpos($string, $string[$i])) => $string[$i];
}
}
foreach (duplicateKeys('badass') as $i => $value) {
echo $i , ' -> ' , $value, PHP_EOL;