Skip to content

Instantly share code, notes, and snippets.

Avatar

Emma Sax emmahsax

View GitHub Profile
@emmahsax
emmahsax / fixing-git-history.md
Last active Nov 11, 2020
A few files I've used in the past to fix Git history
View fixing-git-history.md

Fixing Git History

There are two files that I tend to use to fix up some screwed up git history. None of these files should be used on huge repositories where a lot of people have forks and clones. Running any of these files completely rewrites history and will change the git SHA of all of the later commits.

I've used this first file when I've accidentally committed a bunch of past commits with the wrong email (think work vs. personal emails). To use it:

  1. Make a backup branch: git branch default_branch_backup
  2. Make sure you're back on the default branch: git checkout default_branch
  3. Run the script: email_switch.sh
  4. Wait patiently...
@emmahsax
emmahsax / circleci-config-to-ignore-branch.md
Last active Jul 5, 2022
CircleCI configuration to completely ignore a specific branch
View circleci-config-to-ignore-branch.md

CircleCI Configuration to Ignore a Branch

This file live in the .circleci/ directory of your project, named config.yml:

version: 2.1
jobs:
  skip:
    working_directory: ~/PROJECT_DIRECTORY # If we leave this out, the build will break with missing required arguments
 docker: [ image: circleci/ruby:2.6.5 ] # This doesn't really matter, but just choose any docker image
@emmahsax
emmahsax / turn-utc-dates-to-local-timezone.md
Last active Jul 5, 2022
Turn UTC dates to local Timezone with Javascript
View turn-utc-dates-to-local-timezone.md

Turn UTC Dates to Local Timezone with Javascript

Here's the snippet of HTML that can be used to call this file:

<script src="/js/turn-utc-dates-to-local-timezone.js" type="text/javascript"></script>

And here's the JS file turn-utc-dates-to-local-timezone.js:

@emmahsax
emmahsax / opening-external-links-in-new-tabs.md
Last active Dec 10, 2020
Opening external links in new tabs with Javascript
View opening-external-links-in-new-tabs.md
@emmahsax
emmahsax / blog-post-pagination-with-jekyll-paginate-v2.md
Last active Dec 8, 2021
Blog post pagination with jekyll-paginate-v2
View blog-post-pagination-with-jekyll-paginate-v2.md

Blog Post Pagination with jekyll-paginate-v2

This uses the pagination provided here. See the pagination in action at https://emmasax.com/blog/.

Let's start with the basics. Here's what the Jekyll _config.yml should look like:

title: An Awesome Blog
description: My blog, which is awesome
url: https://an-awesome-blog.com
@emmahsax
emmahsax / jekyll-feed-with-multiple-environments.md
Last active Nov 11, 2020
Jekyll Feed with multiple environments
View jekyll-feed-with-multiple-environments.md

Jekyll Feed with Multiple Environments

What this will do is generate a two different feeds:

  • A feed.xml for your local development, which will contain the values you specify for your development environment in your _config.yml.
  • A feed.xml for your live site, which will have the values set in your _config.yml for your production environment.

This is necessary because without different values for title, description, etc, many feed readers will view the two feeds as the same, even if the post content is different This makes it difficult to test if your feed is working and updating locally.

You could add additional environments as well, such as development, test, staging, and production.