This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update sharks set facts='Hammerheads are more violent than great whites if you piss them off' where name='Hammerhead'; | |
-- single quotes!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# then follow this link: https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-macos commands from this link are below: | |
brew install rbenv | |
nano .bash_profile | |
# etc.: keep following the instructions on that link. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh in, pw Bl4hCr4p!@ | |
and then add: | |
Host *github.com | |
AddKeysToAgent yes | |
IdentityFile ~/.ssh/id_ed25519 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username = input('What is your username?') | |
password = input('What is your password?') | |
password_length = (len(password)) | |
hidden_password = '*' * password_length | |
print(f'{username}, your password, {hidden_password}, is {str(password_length)} letters long') | |
# What is your username?blah | |
# What is your password?crapper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# edit ~/.tmux.conf to make sure 256color said screen: | |
set -g default-terminal screen-256color | |
# then | |
tmux source-file ~/.tmux.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/BetterErrors/better_errors | |
#this also needs the binding_of_caller gem / both are added to Gemfile under the Development section | |
# add these lines to development.rb: | |
### added for better errors gem | |
config.consider_all_requests_local = true | |
# BetterErrors::Middleware.allow_ip! 'xxx.xxx.x.x' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %w makes string arrays out of arrays | |
%w[A B C].map { |char| char.downcase } | |
#=> ["a", "b", "c"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dunder methods are special or magic methods | |
class Toy(): | |
def __init__(self, color, age): | |
self.color = color | |
self.age = age | |
action_figure = Toy('red', 0) | |
print(action_figure.__str__()) #this is the same as: | |
print(str(action_figure)) #this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create clone of an object | |
function cloneMachine(parent) { | |
let clonedName = `${parent.name}Clone` | |
let clone = { | |
name: `${parent.name}Clone`, | |
species: parent.species, | |
offspring: [] | |
}; | |
parent.offspring.push(clonedName); | |
return clone; |