Skip to content

Instantly share code, notes, and snippets.

View Lemmings19's full-sized avatar

Lemmings19

View GitHub Profile
@Lemmings19
Lemmings19 / fetchTags.php
Last active April 24, 2017 06:53
Hit StackOverflow's API and save to a file.
<?php
/**
* This script hits StackOverflow's API and prints the results out to a file in JSON format.
*
* This script is specifically targeted at tags, but you could manipulate it target other things.
*/
$file = fopen('/mnt/projects/tags.txt', 'a');
/**
@Lemmings19
Lemmings19 / productive.js
Created May 2, 2017 22:16
Another day at the office...
console.log('yo dawg' + console.log('we heard you liked logs' + console.log('so we put a log in your log' + console.log('so you could log while you log'))));
@Lemmings19
Lemmings19 / behat-gherkin-laravel.md
Last active June 15, 2017 17:55
Behat & Gherkin Usage in Laravel

Preface

This is a summary of the knowledge I have gained after some research and first tests.

Behat is a tool for writing feature requirement criteria in Gherkin syntax, and integrating this criteria with PHP. In order to work with Behat (a tool) and Gherkin (a syntax or way of writing feature requirements), you will need to understand how to get Behat setup, the role it plays, and how to write using Gherkin.

Behat Setup

The following readme should work: https://github.com/Behat/Behat/blob/master/README.md For Laravel, the following video outlines the process:

@Lemmings19
Lemmings19 / behat-mink-together.md
Last active June 15, 2017 17:48
Using Behat and Mink Together

Preface

These are notes from my initial research into what Behat and Mink are as well as how they interact with one another.

The short of it is that these two tools should not go together. They are two different tools for two different purposes.

Behat is for writing BDD and moving that BDD over to testing the domain (via PHPUnit or a similar tool).

Mink is for testing the front-end user interface of web pages. The logic involved here is typically not domain logic; but rather UI logic.

While it is possible to make these two tools work together, it is not a good idea.

@Lemmings19
Lemmings19 / PasswordBroker.php
Created January 27, 2018 23:06 — forked from jamesfairhurst/PasswordBroker.php
Laravel 5.2 Queue Password Reset Email
<?php
namespace App;
use Illuminate\Auth\Passwords\PasswordBroker as IlluminatePasswordBroker;
class PasswordBroker extends IlluminatePasswordBroker
{
/**
* Send the password reset link via e-mail in a queue
@Lemmings19
Lemmings19 / README.md
Last active March 7, 2018 23:05 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@Lemmings19
Lemmings19 / README.md
Created March 7, 2018 23:04 — forked from oodavid/README.md
Restore MySQL from Amazon S3

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

@Lemmings19
Lemmings19 / sendy_nginx_config.md
Last active February 2, 2019 21:12
Sendy Nginx Configuration 2018-07-11

Installing Sendy at https://mydomain.com/sendy, this worked for me:

Add this into your existing site configuration found at /etc/nginx/sites-available/mydomain.com:

    location /sendy {
        # covers /l, /t, and /w URLs.
        rewrite ^/sendy/(l|t|w)/([a-zA-Z0-9\/]+)$ /sendy/$1.php?i=$2&$args;
        # covers /subscribe and /unsubscribe URLs.
        rewrite ^/sendy/(u?n?subscribe)/(.*)$ /sendy/$1.php?i=$2&$args;
@Lemmings19
Lemmings19 / sendy_error_instructions.md
Last active February 2, 2019 21:07
Sendy "unlicensed domain" Error Fix On Nginx

For me, this was caused because of the Nginx server configruation. I originally had:

server {
    listen       80;
    server_name 12.168.101.224 mydomain.com www.mydomain.com;

    # the rest of the config ...
    . . .
@Lemmings19
Lemmings19 / slugify.js
Created February 24, 2019 03:33 — forked from hagemann/slugify.js
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáäâãåăæçèéëêǵḧìíïîḿńǹñòóöôœṕŕßśșțùúüûǘẃẍÿź·/_,:;'
const b = 'aaaaaaaaceeeeghiiiimnnnoooooprssstuuuuuwxyz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters