Skip to content

Instantly share code, notes, and snippets.

View zenkbaries's full-sized avatar
🎯
Focusing

John Towery zenkbaries

🎯
Focusing
View GitHub Profile
@zenkbaries
zenkbaries / duplicateRepo.md
Created March 13, 2020 19:49
Duplicate a repository

Duplicate Repo

  1. clone the repo
$ git clone --bare https://github.com/exampleuser/old-repository.git
  1. Push to new repository
$ cd old-repository.git
@zenkbaries
zenkbaries / ENV.md
Last active February 1, 2020 18:48
.env with `create-react-app`

Using .env in app created with 'create-react-app'(CRA)

  • .env must be in root of the project
  • all variable in .env should be prefixed with REACT_APP_ in order to be accessible
  • CRA already include dotenv so no need to import it before using process.env.
  • Don't use sensitive info (i.e. Secret Keys) in .env for CRA. It will get exposed.
  • Use backend server to store secret keys and making calls as an added security measure.

These rule don't apply to React app that was created from scratch, not by 'create-react-app'.

@zenkbaries
zenkbaries / update_rails_system_for_new_app.md
Last active June 25, 2021 03:26
Keeping rails updated

// use this to make sure all system is up to date before creating new rails app

gem update --system

@zenkbaries
zenkbaries / reactOnHeroku.md
Last active January 24, 2020 18:28
Deploy React app to Heroku

To deploy React app, which was created using 'create-react-app --use-npm ', to Heroku, the following option need to be included:

heroku create <appname> --buildpack mars/create-react-app

If yo dont use those buildpack option, you might encounter Websocket error when opening the website using HTTPS instead of HTTP.

Information comes from https://create-react-app.dev/docs/deployment/#heroku

*{
margin: 0;
padding: 0;
}
body, html{
height: 100%;
}
.container{
@zenkbaries
zenkbaries / MongoDB Connection with Promise
Created July 22, 2019 23:02
How to establish an connecting with mongoDB with Promise and .catch()
//
// Use this template to establish connection to MongoDB with Promise to handle error
// See documentation at https://mongoosejs.com/docs/connections.html
// If initial connection fails, it will not attempt to reconnect.
// It will attempt to reconnect if there's error AFTER the initial successful connection.
mongoose.connect(process.env.DB_URI, {useNewUrlParser: true})
.then(() => {
console.log("MongoDB database initial connection established successfully.");
})

Keybase proof

I hereby claim:

  • I am zenkbaries on github.
  • I am kbcoder (https://keybase.io/kbcoder) on keybase.
  • I have a public key ASCZQM45H_3R6Exjj4ybSwx1n9wiW82vLGOhAMI9PIOyzQo

To claim this, I am signing this object:

  'use babel';

  import ZenkbarieswordcountView from './zenkbarieswordcount-view';
  import { CompositeDisposable } from 'atom';

  export default {

    zenkbarieswordcountView: null,
    modalPanel: null,
@zenkbaries
zenkbaries / OrionChest rspec test
Created March 7, 2016 17:28
rspec test error result
[1] pry(#<Game>)> pieces.to_a
=> [#<Pawn id: 2235, type: "Pawn", row: 1, column: 4, in_game: true, player_id: 729, game_id: 243, created_at: "2016-03-07 16:45:49", updated_at: "2016-03-07 16:45:49", color: "black">]
[2] pry(#<Game>)> F.......................................................................................
Failures:
1) Moving pieces Dragging a piece(black_pawn) to a valid location
Failure/Error: visit game_path(game)
Capybara::Poltergeist::StatusFailError: