Skip to content

Instantly share code, notes, and snippets.

View martindilling's full-sized avatar
🏴‍☠️

Martin Dilling-Hansen martindilling

🏴‍☠️
View GitHub Profile
@martindilling
martindilling / action.php
Last active December 16, 2015 08:49
Extension of Niels database class to support a way of handling too many failed login attempts.
<?php
session_start();
require_once('config.php');
require_once('db.class.php');
// New instance of the db class
$db = new db(DB_NAME, DB_HOST, DB_USER, DB_PASSWORD);
// If nothing send by _POST, redirect to index
if ( ! count($_POST) > 0)
@martindilling
martindilling / AddLinksToContextMenu.bat
Last active May 21, 2018 11:42
Windows right-click context menus for Sublime Text 3 and opening a terminal window. > Open file with ST3. > Open folder with ST3 (also right-click inside folder). > Open command window here (also right-click inside folder).
@echo off
@rem ==================
@rem Right-click context menus for opening Sublime Text 3
@rem and for opening a terminal window starting in the current folder.
@rem ==================
@rem Edit the following variables if needed.
SET sublimeText3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
SET sublimefilesText=Open with Sublime Text 3
SET sublifoldersText=Open folder with Sublime Text 3
Sublime Text Packages:
DocBlockr
Emmet
Gist
Highlighter
BracketHighlighter
SublimeCodeIntel
SublimeLinter
Theme - Spacegray
{
"theme": "earthsong.sublime-theme",
"color_scheme": "Packages/User/peel (SL).tmTheme",
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 9,
"highlight_line": true,
"ignored_packages": ["Vintage"],
#!/usr/bin/env bash
# ---------------------------------------
# Virtual Machine Setup
# ---------------------------------------
# Adding multiverse sources.
cat > /etc/apt/sources.list.d/multiverse.list << EOF
deb http://archive.ubuntu.com/ubuntu trusty multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse
@martindilling
martindilling / ExtendedValidator.php
Last active August 29, 2015 14:08
Extended laravel validator to support validating each item in an array. Used http://stackoverflow.com/a/26537606 for the most of this.
<?php namespace Validators\ExtendedValidator;
use Illuminate\Validation\Validator;
/**
* Extending Laravels validator to support some extra validation rules.
*
* http://stackoverflow.com/a/26537606
*
* @author Martin Dilling-Hansen <[email protected]>
@martindilling
martindilling / password.php
Last active August 29, 2015 14:13
Generate a secure random password, that has a better change of being remembered than a completely random string.
<?php
/**
* @author Martin Dilling-Hansen <[email protected]>
* @date 2015-01-12
*/
interface hasWords
{
/**
* Get an flat array of words.
@martindilling
martindilling / 2015_09_03_142321_create_coupons_table.php
Created September 3, 2015 15:06
Polymorphic Coupons with Eloquent
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCouponsTable extends Migration
{
public function up()
{
Schema::create('coupons', function (Blueprint $table) {
@martindilling
martindilling / keybase.md
Created July 28, 2016 09:00
Keybase proof

Keybase proof

I hereby claim:

  • I am martindilling on github.
  • I am martindilling (https://keybase.io/martindilling) on keybase.
  • I have a public key ASBSLXzVcyxkYyHJi5VZ0MOMhv7EzBhsvTY1IdfNa-9HHAo

To claim this, I am signing this object:

@martindilling
martindilling / index.php
Created August 25, 2016 11:08
Very very simple template implementation
<?php
/**
* Load a template passing the given data into it.
*
* Note: Assumes templates are loaded from a 'templates' folder.
* Use dot-notation for defining the template name.
* Don't include the file extension in the template name.
* eg. 'pages.home' > 'templates/pages/home.php'
* 'partials.elements.contact-button' > 'templates/partials/elements/contact-button.php'