Skip to content

Instantly share code, notes, and snippets.

View forrestwilkins's full-sized avatar

Forrest Wilkins forrestwilkins

View GitHub Profile
@forrestwilkins
forrestwilkins / muiTheme.ts
Created June 19, 2022 18:52
MUI custom theme boilerplate
import { createTheme, Theme } from "@mui/material/styles";
const initialTheme = createTheme({
typography: {
fontFamily: "Inter",
},
palette: {
background: {},
},
export const useGetProducts = (): [Product[] | undefined, boolean, unknown] => {
const { data, error, isLoading } = useQuery(ApiRoutes.Products, () =>
api.getProducts().then((res) => res)
);
const products = useAppSelector(selectProducts);
const dispatch = useAppDispatch();
useEffect(() => {
if (data) {
dispatch(setProducts(data));
import { Suspense, useState, useEffect } from "react";
const fetchUserProfile = (userId) => {
return new Promise((resolve) => {
resolve({
name: `Forrest ${userId}`,
email: `forrest${userId}@gmail.com`,
});
});
};
import { useEffect, useState } from "react";
import { useMutation, useLazyQuery } from "@apollo/client";
import { IconButton } from "@material-ui/core";
import { ThumbUp } from "@material-ui/icons";
import {
LIKES_BY_POST_ID,
LIKES_BY_MOTION_ID,
LIKES_BY_COMMENT_ID,
} from "../../apollo/client/queries";
# Git
alias commit='git commit -m' #'sh bin/bash/commit.sh'
alias revert='sh bin/bash/revert.sh'
alias pull='git pull'
alias push='git push'
alias clone='git clone'
alias git_reset='git reset --hard origin/master && git pull origin master'
alias checkout='git checkout'
alias main='checkout main && pull'
alias add='git add'
@forrestwilkins
forrestwilkins / onPress.js
Created September 18, 2020 00:49
onPress
onPress={() => {
let request = {
"method": "POST",
"headers": {
"Content-Type": "application/json",
},
"body": JSON.stringify(
{
"lat": 69.6969,
"lng": -69.6969,
@forrestwilkins
forrestwilkins / AndroidManifest.xml
Last active September 5, 2020 02:55
Geolocation
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.covidmap">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:name=".MainApplication"
this.trixInput.current.addEventListener("trix-attachment-add", event => {
let attachment = event.attachment;
if (attachment.file) {
this.uploadImage(attachment);
}
});
ssh root@elheroe.net 'service unicorn stop && cd /home/rails && git pull && export PATH=$PATH:/usr/local/rvm/rubies/ruby-2.1.5/bin && /home/rails/bin/bundle install && /home/rails/bin/rake assets:precompile RAILS_ENV=production && service unicorn start'
# anything after a pound sign is just a comment, like notes, doesn't affect functionality at all
# this is a normal loop, since true is always true, the loop runs forever
while true # while evaluates whatever value it's given by the programmer
puts "This text gets printed to the screen over and over."
end # this is the end of the block. since it's a loop,
# the flow returns back to the top of the while block
# this is a recursive loop
@number = 0 # this is how you create variables, just little jars of data