Skip to content

Instantly share code, notes, and snippets.

View franksteinberg's full-sized avatar

Frank Steinberg franksteinberg

View GitHub Profile
@franksteinberg
franksteinberg / prepare-commit-msg
Created February 10, 2021 21:19 — forked from kevindb/prepare-commit-msg
Prepend commit message with ticket number from branch name
#!/usr/bin/env python
# https://gist.github.com/kevindb/a360c8e90bcdf6364f1523a5787c8d89
import sys, re
from subprocess import check_output
commit_msg_filepath = sys.argv[1]
branch = check_output(['git', 'branch', '--show-current'])
@franksteinberg
franksteinberg / prepare-commit-msg.sh
Last active July 16, 2020 01:35 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
AFTER_FIRST_SLASH=$(echo "${BRANCH_NAME#*/}")
@franksteinberg
franksteinberg / EmployeeFactory.php
Created March 1, 2019 18:17
Possible Employee Factory (instead of Employer factory)
$factory->define(Employee::class, function ($faker) use ($factory) {
return [
'user_id' => factory(User::class)->create()->id,
'employer_id' => factory(Employer::class)->create()->id
];
});
@franksteinberg
franksteinberg / VerifyJwtToken.php
Last active January 16, 2019 20:36
VerifyJwtToken Middleware
<?php
namespace App\Http\Middleware;
use Closure;
class VerifyJwtToken
{
/**
* Handle an incoming request.
<?php
use App\Website;
class ItCanMatchWildcardQueriesTest extends TestCase
{
/**
* @test
* @dataProvider matchingQueries
*/
@franksteinberg
franksteinberg / FactorFinder.php
Last active July 31, 2018 21:04
Finds the largest palindromic number that can be made by multiplying two numbers of a specified length together.
<?php
/**
* User: frank.steinberg
* Date: 7/30/18
* Time: 11:57 AM
*/
class FactorFinder
{
@franksteinberg
franksteinberg / FactorFinder.php
Created July 30, 2018 16:32
Finds the largest palindromic number that is the product of two 3-digit numbers
<?php
/**
* User: frank.steinberg
* Date: 7/30/18
* Time: 11:57 AM
*/
class FactorFinder
{
public function run()

Keybase proof

I hereby claim:

  • I am franksteinberg on github.
  • I am frankincredible (https://keybase.io/frankincredible) on keybase.
  • I have a public key whose fingerprint is EF2B F7F4 1F58 1611 829E 1A26 0989 9540 F4DF 6F1C

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am frankincredible on github.
* I am frankincredible (https://keybase.io/frankincredible) on keybase.
* I have a public key whose fingerprint is EF2B F7F4 1F58 1611 829E 1A26 0989 9540 F4DF 6F1C
To claim this, I am signing this object: