Skip to content

Instantly share code, notes, and snippets.

View wescopeland's full-sized avatar

Wes Copeland wescopeland

View GitHub Profile
function testBeatenGame(int $gameId, string $user, bool $postBeaten): array
{
$totalProgressions = Achievement::where('GameID', $gameId)
->where('type', AchievementType::Progression)
->where('Flags', AchievementFlag::OfficialCore)
->count();
$progressionTierAchievements = Achievement::where('Achievements.GameID', $gameId)
->whereIn('Achievements.type', [AchievementType::Progression, AchievementType::WinCondition])
->where('Achievements.Flags', AchievementFlag::OfficialCore)
@wescopeland
wescopeland / RA_LockedColored.user.js
Created April 18, 2023 02:58
Working LockedColored if badge hover colorization is merged
// ==UserScript==
// @name RA_LockedColored
// @version 0.1
// @author Xymjak
// @match http://localhost:64000/game/*
// @match http://localhost:64000/achievement/*
// @match https://retroachievements.org/game/*
// @match https://retroachievements.org/achievement/*
// @icon https://www.google.com/s2/favicons?domain=retroachievements.org
// @grant none
@wescopeland
wescopeland / VeryLargeImage.tsx
Created July 27, 2021 01:54
Perfect LCP Scores Every Time
import type { VFC } from "react";
export const VeryLargeImage: VFC = () => {
return (
<img
width="99999"
height="99999"
style={{
pointerEvents: "none",
position: "absolute",
@wescopeland
wescopeland / .eslintrc.js
Last active March 16, 2021 09:49
God Tier ESLint Config
module.exports = {
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
@wescopeland
wescopeland / CurrentBreakpointDisplay.tsx
Created March 13, 2021 04:10
Current breakpoint HUD component
// Obviously, don't ship this to production. I have this behind an environment flag in _app.tsx, like so:
/*
import dynamic from "next/dynamic";
let DynamicCurrentBreakpointDisplay;
if (process.env.NODE_ENV === "development") {
DynamicCurrentBreakpointDisplay = dynamic(() =>
import("../../app/core/components/CurrentBreakpointDisplay").then(
(m) => m.CurrentBreakpointDisplay
)
@wescopeland
wescopeland / library-builder.class.ts
Last active June 27, 2020 17:34
Nx Library Builder
import * as prompts from 'prompts';
import { dasherize } from '@angular-devkit/core/src/utils/strings';
import { prompt } from 'enquirer';
import { spawn } from 'child_process';
export type LibraryType = 'feature' | 'ui' | 'data-access' | 'util';
export type LibraryDomain = 'app-specific' | 'grouped app-specific' | 'shared';
export type SchematicType = 'angular' | 'react' | 'workspace';
export interface UserResponses {
@wescopeland
wescopeland / stateful.component.ts
Created June 16, 2019 13:29
stateful.component.ts
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { AwesomeEntity, AwesomeEntitiesQuery } from './+state';
@Component({
selector: 'app-stateful-component',
template: /* html */ `
<app-presentational-button></app-presentational-button>
`
@wescopeland
wescopeland / stateful.component.spec.ts
Created June 16, 2019 13:29
stateful.component.spec.ts
import { Spectator, SpyObject, createTestComponentFactory } from '@netbasal/spectator/jest';
import { of } from 'rxjs';
import { StatefulComponent } from './stateful.component';
import { AwesomeEntitiesQuery } from './+state';
describe('Component: StatefulComponent', () => {
let query: SpyObject<AwesomeEntitiesQuery>;
let spectator: Spectator<StatefulComponent>;
@wescopeland
wescopeland / presentational-button.component.ts
Created June 16, 2019 13:23
presentational-button.component.ts
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
@Component({
selector: 'app-presentational-button',
template: /* html */ `
<button (click)="handleButtonClick()">
{{ buttonLabel || 'Submit' }}
</button>
`
})
@wescopeland
wescopeland / presentational-button.component.spec.ts
Created June 16, 2019 13:23
presentational-button.component.spec.ts
import { Spectator, createTestComponentFactory } from '@netbasal/spectator/jest';
import { PresentationalButtonComponent as PBComponent } from './presentational-button.component';
describe('Component: PresentationalButtonComponent', () => {
let spectator: Spectator<PBComponent>;
const createComponent = createTestComponentFactory<PBComponent>({
component: PBComponent
});