Skip to content

Instantly share code, notes, and snippets.

View keeperofthenecklace's full-sized avatar

Albert McKeever keeperofthenecklace

  • New Jersey, U.S.A
View GitHub Profile
@keeperofthenecklace
keeperofthenecklace / MYSQL SHORTCUT KEYS
Last active September 10, 2023 14:50
MYSQL SHORTCUT KEYS
MYSQL
-----------
Run this on the command line. Not in mysql console.
eg. $alberta_makeever: mysql -u root -p user_development << sample.sql
mysql5 -u root -p
enter password:kwame1
mysql> exit;
Order.includes(:order_products).where("order_products.product_id = 16227").references(:order_products)
@keeperofthenecklace
keeperofthenecklace / Github Cheat Sheet
Last active October 26, 2022 20:52
Github Cheat Sheet
Step B.) Creating a branch (and switching to the new branch in one line (Step 2)
**********
a.) git checkout -b [name of new branch]
eg. git checkout -b 2012Tryme
git fetch origin [remote-branch]:[new-local-branch] (Pulling a new branch from a remote repository)
b.) follow step 1
c.) git push origin 2012Tryme
** will add new branch to the repository on git hub
**********************
Step A.) Scheduling the addition of all files to the next commit (Step 1)
@keeperofthenecklace
keeperofthenecklace / Testing REST APIs with Cucumber and Rack::Test
Created August 18, 2012 20:00
Testing REST APIs with Cucumber and Rack::Test
# First attempting to use Capybara directly, you will ran into issues when trying to set HTTP header.
# Using Basic HTTP Authentication requires that we needed to set the header.
# Also we need to set the Content-Type and Accept headers to ensure that Rails handles the input and output correctly.
# When using Rack, Capybara delegates request and response handling down to Rack::Test.
# So I used Rack::Test directly in my step definitions, and it works.
# Rack::Test has a module called Rack::Test::Methods that can be mixed into a class to provide it
# with methods for get, post, put, delete as well as last_request, last_response, header and more.
# I mixed Rack::Test::Methods into the Cucumber world at the top of our API steps file like so:
##############################
@keeperofthenecklace
keeperofthenecklace / Mnitest
Created January 14, 2014 16:52
Running minutest
rake test TEST=test/models/admin_ability_test.rb
CTRL Ww moves you from window to window (
CTRL WT moves current window into a tab
t (While in nerdtree) opens the file in a tab.
gt Goes to next tab.
gT Goes to previous tab.
\n Toggles the NerdTree on or off.
Command T - find in project.
new_record?
any?
kind_of?
include?
nil?
blank?
clear?
empty?
ActiveRecord
-----------
SERIALIZED ATTRIBUTE
$ rails c --sandbox or rails c development
#create class method
$ user = User.create( name" "albert", email: "kotn_ep1@hotmail.com" )
#new class method
@keeperofthenecklace
keeperofthenecklace / IRB - Useful commands
Created August 24, 2012 11:21
IRB - Useful commands
$ IRB ****Let you into Ruby Interpreter
1.9.3-p194 :088 > use TAB key to autocomplete.
1.9.3-p194 :089 > help
Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.
@keeperofthenecklace
keeperofthenecklace / Loading ruby script in IRB
Created August 23, 2012 17:36
Loading ruby script in IRB
cd into directory of the Ruby.rb file...
it-macbook-albert:karoake albertmckeever$ IRB
1.9.3-p194 :001 > load 'song.rb'
=> true
@keeperofthenecklace
keeperofthenecklace / Command line Shortcut
Created August 22, 2012 16:58
Command line Shortcut
Esc shft + b - moves cursor(c) BACK to begin of a text. eg. (c)albert (c)mckeever (c)help
Esc shft+ f moves cursor(c) FORWARD to begin of a text. eg. (c)albert (c)mckeever (c)help
shft + cmd - selects all
Ctrl+A and Ctrl+E - home and end
Ctrl+U: This clears the entire line so you can type in a completely new command.
Ctrl+K: This deletes the line from the position of the cursor to the end of the line.
Ctrl+W: This deletes the word before the cursor only.
Ctrl+R: This lets you search your command history for something specific.
Tab: autocomplete