Skip to content

Instantly share code, notes, and snippets.

View ShaneRich5's full-sized avatar
🏠
Working from home

Shane Richards ShaneRich5

🏠
Working from home
  • FTI Consulting
  • New York, NY
View GitHub Profile
public function index(Request $request)
{
$query = Post::query();
$query->where('status', $request->input('status'));
$query->whereHas('author', function ($q) use ($request) {
$q->where('name', 'like', '%' . $request->input('author') . '%');
});
@ShaneRich5
ShaneRich5 / controller.php
Last active May 20, 2025 04:56
Fundamentals 3
// PostController::store
public function store(Request $request)
{
$data = $request->validate([
'title' => 'required|string|max:255',
'body' => 'required|string',
]);
if (strlen($data['body']) < 50) {
import React from 'react'
export default function useIntersectionObserver({
root,
target,
onIntersect,
threshold = 1.0,
rootMargin = '0px',
enabled = true,
}) {
const seconds = 1619798400
const date = new Date(1970, 0, 1) // Epoch
date.setSeconds(seconds)
@ShaneRich5
ShaneRich5 / register.dart
Created December 16, 2020 02:07
flutter sample
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class RegistrationScreen extends StatefulWidget {
static const routeName = '/register';
@override
State<StatefulWidget> createState() {
return _RegistrationState();
}
@ShaneRich5
ShaneRich5 / assignment_2.cpp
Created October 15, 2020 19:10
Assignment
#include <iostream>
using namespace std;
//enum Months { Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov,Dec};
char skip;
char response;
int m = 0, d = 0, y = 0;
int OrdDay = 0, priorDays = 0;
bool IsLeapYear(int y, int priorDays)
@ShaneRich5
ShaneRich5 / test.ts
Created April 30, 2020 18:27
angular test
import { fakeAsync, tick } from '@angular/core/testing';
describe('brainstorming test', () => {
test('ngOnInit() should initiate autocomplete and its dataset', fakeAsync(() => {
// const mockedTemplateOptions = jest.fn() as any as FormlyTemplateOptions;
// component.to = mockedTemplateOptions;
// const mockedTemplateOptions = jest.spyOn(component.to, 'search').mockReturnValue('a');
@ShaneRich5
ShaneRich5 / basic_fib_checker.py
Created September 29, 2018 07:41
Fibonnaci Checker
def Fib_Checker(lst):
size = len(lst)
if size == 0:
return False
start = lst[0]
previous, current = 0, 1
if settings.TESTING:
import coverage
cov = coverage.coverage(source=['entities'], omit=['*/tests/*'])
cov.set_option('report:show_missing', True)
cov.erase()
cov.start()
execute_from_command_line(sys.argv)