Skip to content

Instantly share code, notes, and snippets.

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. Here's how to do it:

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore (or skip and force-add afterwards).

@roberthamel
roberthamel / how-to-launch-any-app-with-a-keyboard-shortcut.md
Last active January 4, 2017 19:07
Launch any Mac app with a keyboard shortcut

How to launch any app with a keyboard shortcut

Automator Service

  1. launch automator
  2. file -> new
  3. click on services then click the choose button

No input, any application

@roberthamel
roberthamel / Form.js
Created May 6, 2017 01:54
Object oriented forms
class Errors {
/**
* Create a new Errors instance.
*/
constructor() {
this.errors = {};
}
/**
@roberthamel
roberthamel / gh-pages-deploy.md
Created May 10, 2017 17:45 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@roberthamel
roberthamel / .env.travis
Created May 10, 2017 22:12 — forked from gilbitron/.env.travis
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@roberthamel
roberthamel / .htaccess
Created May 11, 2017 21:20 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@roberthamel
roberthamel / eslintrc.json
Created September 6, 2017 19:30
React Native eslint config
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": true
},
"plugins": [
"react"
],
"rules": {
@roberthamel
roberthamel / freecodecampe-randomquotemachine.markdown
Created September 30, 2017 19:52
freecodecampe-RandomQuoteMachine
@roberthamel
roberthamel / generate-pushid.js
Created January 8, 2018 03:53 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/