Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
old and eccentric

Shawn McCool ShawnMcCool

💭
old and eccentric
View GitHub Profile
View KalmanFilter.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Tabi.DataObjects;
namespace Tabi.Logic
{
public class KalmanLatLong : PositionEntry // Implementation taken from: https://stackoverflow.com/questions/1134579/smooth-gps-data/15657798#15657798
{
@ShawnMcCool
ShawnMcCool / .zshrc
Last active Jul 19, 2017
Moves the most recently modified file from the source directory to the destination directory.
View .zshrc
alias mvltr="~/scripts/mvltr.sh"
alias ltr="ls -ltr"
@ShawnMcCool
ShawnMcCool / A Simple PHP Postmark Library.md
Last active Feb 21, 2017
Simple postmark email send / batching.
View A Simple PHP Postmark Library.md

Examples:

public function sendSingleExample() {
    (new SendMailViaAPI('<postmark-server-token>'))->single(
        new Mail('sender name', 'sender email', 'recipient email', 'hello from exampletown', '<strong>this is bold</strong> this is not.')
    );
}

public function sendBatchExample() {
@ShawnMcCool
ShawnMcCool / lowresvga.sh
Last active Jun 23, 2016
XRANDR Scripts for Dutch PHP Conference for 16:9 laptops
View lowresvga.sh
#!/bin/bash
# "./lowresvga.sh" to enable 1024x768
# "./lowresvga.sh off" to return
# This was made for a Thinkpad T450s, substitute your devices.
if [ "$1" = "off" ] ; then
echo "disabling"
xrandr --output DP2 --off
xrandr --output eDP1 --mode 1920x1080
@ShawnMcCool
ShawnMcCool / BladeParser.php
Created Nov 26, 2013
Simple Blade Tag Abstraction.
View BladeParser.php
<?php namespace Sterling\BladeParsing;
class BladeParser
{
protected $tags = [];
public function parse($view)
{
foreach ($this->tags as $tag) {
if ($tag->getMatchCount($view) > 0) $view = $tag->transform($view);
@ShawnMcCool
ShawnMcCool / gist:7573251
Created Nov 20, 2013
This is an example Gist.
View gist:7573251
This is just an example.. Go make you're own!
View shawn_snippets.sublime-snippet
<snippet>
<content><![CDATA[
<div class="clearfix">
<label for="$1">$2</label>
<div class="input">
<?=form_input('$1', set_value('$1'))?>
</div>
</div>
]]></content>
<tabTrigger>formtext</tabTrigger>
View idiomatic-ar.php
<?php
# Discussion about idiomatic ActiveRecord usage
## Please help me to determine the idiomatic approach for creating a member and attaching an invoice ONLY IF the member doesn't already have 5 invoices.
class Member extends Eloquent {
}
$member = Member::create([
@ShawnMcCool
ShawnMcCool / gist:16cac102e06d02365403
Created Jun 17, 2015
A Sequence Collecton for C#
View gist:16cac102e06d02365403
using System.Collections.Generic;
using Infrastructure;
using NUnit.Framework;
namespace Collections {
[TestFixture] public class SeqTests {
[Test]
public void can_access_the_head() {
var seq = new Seq<DomainEvent>();
var first = new TestEvent();
@ShawnMcCool
ShawnMcCool / php-visibility
Last active Aug 29, 2015
PHP Visibility by Example
View php-visibility
<?php
namespace PrivateExample {
class Animal {
private $innermostFeelings = "HUNGER";
public function __construct() {
echo "Animal feels $this->innermostFeelings\n";
}
public function empathy(Animal $other) {
You can’t perform that action at this time.