Skip to content

Instantly share code, notes, and snippets.

View RyanWarner's full-sized avatar
👋

Ryan Warner RyanWarner

👋
View GitHub Profile
@LeviSnoot
LeviSnoot / discord-timestamps.md
Last active June 14, 2024 21:27
Discord Timestamp Syntax

Discord Timestamps

Discord timestamps can be useful for specifying a date/time across multiple users time zones. They work with the Unix Timestamp format and can be posted by regular users as well as bots and applications.

The Epoch Unix Time Stamp Converter is a good way to quickly generate a timestamp. For the examples below I will be using the Time Stamp of 1543392060, which represents November 28th, 2018 at 09:01:00 hours for my local time zone (GMT+0100 Central European Standard Time).

Formatting

Style Input Output (12-hour clock) Output (24-hour clock)
Default <t:1543392060> November 28, 2018 9:01 AM 28 November 2018 09:01
@trevorblades
trevorblades / PostLayout.js
Created August 31, 2020 02:25
Auto-generated social images
import PageLayout from './PageLayout';
import PropTypes from 'prop-types';
import React from 'react';
import getShareImage from '@jlengstorf/get-share-image';
import {Helmet} from 'react-helmet';
export default function PostLayout({children, pageContext}) {
const {title, description, tags} = pageContext.frontmatter;
const shareImage = getShareImage({
title,
@kevindice
kevindice / react-app-s3-sync.sh
Created January 27, 2019 02:19
A shell script for uploading a React app build to S3 + CloudFront for deployment
#!/bin/bash
S3_BUCKET_NAME=$1
CF_ID=$2
# Sync all files except for service-worker and index
echo "Uploading files to $S3_BUCKET_NAME..."
aws s3 sync build s3://$S3_BUCKET_NAME/ \
--acl public-read \
--exclude service-worker.js \
@jacklorusso
jacklorusso / workbench.colorCustomizations.json
Last active December 19, 2023 07:40
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",
@armand1m
armand1m / withInitialData.js
Created November 15, 2017 22:38
Simple HOC for fetching data that is compatible with the SSR technique described by @BenLu here: https://medium.com/@benlu/ssr-with-create-react-app-v2-1-ee83fb767327
import React, { Component } from 'react';
const hasDataForThisKey = (staticContext) =>
(key) => staticContext && Object.keys(staticContext.data).includes(key);
const windowHasDataForThisKey = (window) =>
(key) => Object.keys(window.__DATA__).includes(key);
export default ({
key,
import inlineStyles from './styles?inline' // Will be loaded with url-loader
import externalStyles from './styles?external' // Will be loaded with file-loader
/** The following rules would make the above imports behave in different ways: **/
{
test: /\.css$/,
oneOf: [
{
resourceQuery: /inline/,
use: 'url-loader',
@jaredpalmer
jaredpalmer / withSSR.js
Last active August 1, 2019 00:40
SSR HOC
import React from 'react';
import axios from 'axios';
// This is a Higher Order Component that abstracts duplicated data fetching
// on the server and client.
export default function SSR(Page) {
class SSR extends React.Component {
static getInitialData(ctx) {
// Need to call the wrapped components getInitialData if it exists
return Page.getInitialData
@ajaxray
ajaxray / firebase-online-user-count-example.md
Last active July 18, 2022 09:57
Keep list (and count) of online users in a Firebase web app - by isolated rooms or globally

Gathering.js - How to use

Keep list (and count) of online users in a Firebase web app - by isolated rooms or globally.

Live Demo

Firebase Shared Checklist is a demo application that shows the number of users joined a checklist using gathering.js. Here is a 1 minute screencast of using this application.

@Critter
Critter / node.cmd
Created February 13, 2015 21:21
Install and link node with brew
Critter:lib critter$ brew install node
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/node-0.12.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring node-0.12.0.yosemite.bottle.1.tar.gz
==> Caveats
If you update npm itself, do NOT use the npm update command.
The upstream-recommended way to update npm is:
npm install -g npm@latest
Bash completion has been installed to:
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active May 7, 2024 13:07
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*