Skip to content

Instantly share code, notes, and snippets.

View jhas3c's full-sized avatar

jhasec jhas3c

View GitHub Profile
@jhas3c
jhas3c / database.yml.example mysql2
Created July 16, 2017 08:52 — forked from erichurst/database.yml.example mysql2
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@jhas3c
jhas3c / multi-git.md
Created April 2, 2018 17:28 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

@jhas3c
jhas3c / dump.txt
Created April 2, 2018 18:14 — forked from rosswd/dump.txt
Database dumps
https://en.wikipedia.org/wiki/Wikipedia:Database_download
https://archive.org/details/stackexchange
http://www.imdb.com/interfaces
https://dmoztools.net/docs/en/rdf.html
https://www.cia.gov/library/publications/the-world-factbook/
https://www.rfc-editor.org/retrieve/
http://download.geonames.org/export/
https://www.census.gov/main/www/cen2000.html
https://www.census.gov/population/www/cen2000/briefs/
http://ucdata.berkeley.edu/index.php
@jhas3c
jhas3c / cloudSettings
Last active July 15, 2021 12:31 — forked from rosswd/apps.md
2017 MacOS Apps
{"lastUpload":"2021-07-15T12:31:41.248Z","extensionVersion":"v3.4.3"}
@jhas3c
jhas3c / users.sql
Created April 2, 2018 18:15 — forked from rosswd/users.sql
Managing users in MySQL
-- start mysql daemon
mysql.server start
-- connect as root
mysql -u root -p
-- create a new limited user
-- [field] = placeholder for your situation
CREATE USER '[username]'@'localhost' IDENTIFIED BY '[password]';
GRANT SELECT, INSERT, UPDATE, ALTER ON *.* TO '[username]'@'localhost';
@jhas3c
jhas3c / ImageUploadComponent.jsx
Created April 6, 2018 06:00 — forked from hartzis/ImageUploadComponent.jsx
React Image Uploading Component with Image Preview
class ImageUpload extends Component {
constructor(props) {
super(props);
this.state = {
file: '',
imagePreviewUrl: ''
};
this._handleImageChange = this._handleImageChange.bind(this);
this._handleSubmit = this._handleSubmit.bind(this);
}
@jhas3c
jhas3c / postgres-cheatsheet.md
Created April 12, 2018 17:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@jhas3c
jhas3c / terminal-git-branch-name.md
Created November 17, 2018 09:28 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@jhas3c
jhas3c / handling_multiple_github_accounts.md
Created September 3, 2019 18:18 — forked from Jonalogy/handling_multiple_github_accounts.md
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@jhas3c
jhas3c / fix-libv8-mac.txt
Created April 11, 2020 18:38 — forked from fernandoaleman/fix-libv8-mac.txt
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install