Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Working on Side Projects

Allan MacGregor amacgregor

:shipit:
Working on Side Projects
View GitHub Profile
@amacgregor
amacgregor / bspwmrc
Created May 19, 2020
Ubuntu 20.04 BSPWM + SXHD configuration
View bspwmrc
#!/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
View .vimrc
"""""""""""""""""""""""""""""""""""""
" Allan MacGregor Vimrc configuration
"""""""""""""""""""""""""""""""""""""
set nocompatible
syntax on
set nowrap
set encoding=utf8
"""" START Vundle Configuration
View solution.ex
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 Aug 12, 2013
Full installation script for the mdg_giftregistry
View install-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
/**
* Create Registry Type Table
*
@amacgregor
amacgregor / UserSingleton.php
Last active Feb 2, 2019
PHP Singleton pattern example
View UserSingleton.php
<?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 / StockItem.php
Created Jan 20, 2019
Example Stock Item class without dependency injection
View StockItem.php
<?php
class StockItem {
private $quantity;
private $status;
public function __construct($quantity, $status){
$this->quantity = $quantity;
$this->status = $status;
@amacgregor
amacgregor / StockItem.php
Last active Jan 20, 2019
Example Stock Item class without dependency injection
View StockItem.php
<?php
class StockItem {
private $quantity;
private $status;
public function __construct($quantity, $status){
$this->quantity = $quantity;
$this->status = $status;
View Effective_Engineer.md

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

View Effective_Engineer.md

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

View HeroToken_Basic.sol
pragma solidity ^0.4.18;
contract HeroToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial supply tokens to the creator of the contract */
function HeroToken(
uint256 initialSupply
) public {
You can’t perform that action at this time.