Skip to content

Instantly share code, notes, and snippets.

View bredmor's full-sized avatar
🔥
This is fine.

Morgan Breden bredmor

🔥
This is fine.
View GitHub Profile
@bredmor
bredmor / squash.txt
Created January 12, 2022 19:11
Squash feature commits w/ no rebase
## Squashes all commits ahead of dev on current branch into one
## Before running, ensure all working files are comitted to feature branch
# Start on the current state of develop
git checkout develop
# Create a new temporary working branch
git checkout -b feature/TICKET-0000_temp
#include <cstdio>
#include <windows.h>
#define INPUT_MAX 255
void main()
{
wchar_t wstr[INPUT_MAX];
char mb_str[INPUT_MAX * 3 + 1];
unsigned long readln;
@bredmor
bredmor / .bash_aliases
Last active August 5, 2020 12:51
EZ Timelog
alias tlog='bash ~/tlog.sh'
alias tend='bash ~/tend.sh'
alias tview='cat ~/work.txt'
@bredmor
bredmor / php74.sh
Last active July 15, 2020 20:16
Install php 7.4 on Ubuntu 16/18
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.4
sudo apt-get install -y php7.4-{bcmath,bz2,common,curl,intl,gd,mbstring,mysql,opcache,xml,zip}
@bredmor
bredmor / NovaServiceProvider.php
Created June 16, 2020 16:59
Forwarding Laravel Nova GET parameters to filters/cards/metrics/etc.
class NovaServiceProvider extends NovaApplicationServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();
@bredmor
bredmor / MathHelper.php
Last active December 4, 2020 13:26
BCMath functions helper for laravel
<?php
namespace App\Helpers;
/**
* Class MathHelper
* @package App\Helpers
*
* Implements negative, ceiling, floor and round functions with BCMath precision
* Credit to Matt Raines for function logic: https://stackoverflow.com/users/5024519/matt-raines
*/
@bredmor
bredmor / s3.php
Created December 9, 2019 21:48
s3 presigned uri request
/**
* Get presigned url to access xml file directly on s3.
*/
public function getXmlUrlAttribute()
{
$client = Storage::disk('s3')->getAdapter()->getClient();
$command = $client->getCommand('GetObject', [
'Bucket' => config('filesystems.disks.s3.bucket'),
'Key' => $this->xml_path,
]);
@bredmor
bredmor / gist:11a4e61cb6fcb3e32570578324540b4d
Created August 19, 2019 16:27
Cygwin terminal value for jetbrains IDE
"c:\cygwin64\bin\sh" -lic "cd ${OLDPWD-.}; bash"
@bredmor
bredmor / main.py
Created December 8, 2018 01:39
2D terrain generator by /u/wtf_that_guy @ reddit
import random
import time
class RandomNoise():
"""
Random noise class to create random values in 2d array
"""
def __init__(self, width=32, height=32, bit_depth=255, extra=32):
self.w = width + extra
self.h = height + extra
var opentiles = [];
var tileId = 0;
var currentTiles = 0;
var maxTiles = 50;
var allTiles = [];
var tile_size = 20;
function boolRand(){
return Math.random()<.5;