Skip to content

Instantly share code, notes, and snippets.

View jarrodhroberson's full-sized avatar

Jarrod Roberson jarrodhroberson

View GitHub Profile
@jarrodhroberson
jarrodhroberson / error.go
Created November 8, 2023 04:55
Native error interface definition.
type error interface {
Error() string
}
function purge() {
var promotions = GmailApp.search("category:promotions")
for (var i = 0; i < promotions.length; i++) {
Gmail.Users.Threads.remove('me', promotions[i].getId())
}
var forums = GmailApp.search("category:forums")
for (var i = 0; i < forums.length; i++) {
Gmail.Users.Threads.remove('me', forums[i].getId())
}
package main
import (
"fmt"
"reflect"
"time"
)
type TimeStamp struct {
T time.Time
@jarrodhroberson
jarrodhroberson / App.vue
Created June 6, 2023 01:59
Reactive Component Vue 3
<script setup>
import { ref } from 'vue'
import CustomInput from './CustomInput.vue'
const messages = ref([])
messages.value.push({channel: { title: "Jarrod Roberson"}})
messages.value.push({channel: { title: "Julian Roberson"}})
messages.value.push({channel: { title: "Sebastian Roberson"}})
messages.value.push({channel: { title: "Valentino Roberson"}})
@jarrodhroberson
jarrodhroberson / typesafebuilder.go
Last active May 25, 2023 15:50
typesafebuilder.gotype safe builder in GoType Safe Builder in Go
/*
* It becomes painfully obvious why this pattern is NOT embraced by the Go community.
* Just to be painfully clear, DO NOT DO THIS!
*/
package main
import (
"fmt"
)
@jarrodhroberson
jarrodhroberson / helloworld.asm
Created May 21, 2023 11:29
Hello World! C= 64
; program start
Start
jsr $FF81 ; CINT (clear screen)
sei ; turn off interrupts
ldy #0
sty $d020 ; reset border color
Loop
lda Message,y ; load message byte
beq EOM ; 0 = end of string
clc
@jarrodhroberson
jarrodhroberson / tictactoe.py
Created July 25, 2019 17:10
Python 3 TicTacToe Game for Console
# Import needed modules
import os
import time
import re
# Regular Expression to validate that the input is in the expected format!
inputPattern = re.compile('^\d{1},\d{1}$')
#Initialize a 2D array to represent the board using a SPACE to represent unclaimed cells.
board = [[' ' for x in range(3)] for y in range(3)]
public static final Ordering<SubCategory> NATURAL_ORDER;
static
{
NATURAL_ORDER = new Ordering<SubCategory>() {
@Override
public int compare(@Nullable final SubCategory left, @Nullable final SubCategory right)
{
return ComparisonChain.start()
.compare(checkNotNull(left).categoryId, checkNotNull(right).categoryId)
@jarrodhroberson
jarrodhroberson / .bash_aliases
Last active April 24, 2018 14:02
bash scripts
alias ll='ls -lha --color=always'
alias subl='subl --touch --cygstart --'
@jarrodhroberson
jarrodhroberson / String.prototype.format.js
Created November 16, 2017 00:55
String.prototype.format
String.prototype.format = function() {
var self = this,
formats = self.match(/{(:?\d*)}/g), // an array of formats `{}` found in the string
counter = 0, // A counter to keep track of what index to replace with
args = arguments; // Dereferencing arguments for use in the nested code blocks
if (formats) {
formats.forEach(function(format) { // We loop through each format expression in the array
var namedMatch = format.match(/{:(\d+)}/), // Checking if the format is a named replacement (i.e. {:1})
reg;