Skip to content

Instantly share code, notes, and snippets.

View amacgregor's full-sized avatar
:shipit:
Working on Side Projects

Allan MacGregor amacgregor

:shipit:
Working on Side Projects
View GitHub Profile
@amacgregor
amacgregor / UserSingleton.php
Last active March 8, 2024 07:25
PHP Singleton pattern example
<?php
/** Example taken from http://www.webgeekly.com/tutorials/php/how-to-create-a-singleton-class-in-php/ **/
class User
{
// Hold an instance of the class
private static $instance;
// The singleton method
@amacgregor
amacgregor / app.css
Created March 7, 2021 00:36
Css for phoenix_fund
/* This file is for your main application css. */
@import "../node_modules/nprogress/nprogress.css";
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "./custom.css";
"""""""""""""""""""""""""""""""""""""
" Allan MacGregor Vimrc configuration
"""""""""""""""""""""""""""""""""""""
set nocompatible
syntax on
set nowrap
set encoding=utf8
"""" START Vundle Configuration
@amacgregor
amacgregor / bspwmrc
Created May 19, 2020 17:08
Ubuntu 20.04 BSPWM + SXHD configuration
#!/bin/sh
# Configure the workspaces
for monitor in $(bspc query -M); do
bspc monitor $monitor -d 1 2 3 4 5 6 7 8 9
done
sxhkd &> /var/log/sxhkd.log &
bspc config border_width 1
@amacgregor
amacgregor / postcss.config.js
Created March 7, 2021 00:35
Configuration files for phoenix_fund
module.exports = {
plugins: {
"postcss-import": {},
tailwindcss: {},
autoprefixer: {},
"postcss-nested": {}
}
}
defmodule UniqueStrings do
@moduledoc """
Combinatronics exercise
reference: https://www.codewars.com/kata/586c7cd3b98de02ef60001ab/train/elixir
Goal: Calculate permutations without repetition
Formula: P(n,r)=n!(n−r)!
"""
def uniq_count(string) do
string = String.upcase(string)
@amacgregor
amacgregor / install-0.1.0.php
Created August 12, 2013 22:43
Full installation script for the mdg_giftregistry
<?php
$installer = $this;
$installer->startSetup();
/**
* Create Registry Type Table
*
@amacgregor
amacgregor / StockItem.php
Created January 20, 2019 20:37
Example Stock Item class without dependency injection
<?php
class StockItem {
private $quantity;
private $status;
public function __construct($quantity, $status){
$this->quantity = $quantity;
$this->status = $status;
@amacgregor
amacgregor / StockItem.php
Last active January 20, 2019 20:36
Example Stock Item class without dependency injection
<?php
class StockItem {
private $quantity;
private $status;
public function __construct($quantity, $status){
$this->quantity = $quantity;
$this->status = $status;