Skip to content

Instantly share code, notes, and snippets.

View jittdev's full-sized avatar

Subrosa Games LLC jittdev

View GitHub Profile
@jittdev
jittdev / GemsCommon1.rb
Created March 14, 2023 13:57
Gems Common :: #Ruby / Rails
gem 'will_paginate'
gem "font-awesome-rails"
gem "paperclip", "~> 5.0.0"
gem 'devise', '~> 4.2'
gem 'colorbox-rails'
gem 'awesome_print'
gem 'paypal-recurring'
gem 'rpush'
gem 'active_record_union'
gem 'entity_storage'
@jittdev
jittdev / AddingReact.JsSupportToExistingWebpackerRails6App1.txt
Created March 14, 2023 13:57
adding React.js support to existing webpacker rails 6 app :: #REACT
bundle exec rails webpacker:install:react
# then add
<%= javascript_pack_tag 'application' %>
# then on command line:
bundle exec rails generate react:install
# then to create first react component:
rails g react:component HelloWorld greeting:string
@jittdev
jittdev / .Foreach1.js
Created March 14, 2023 13:57
.forEach :: #Javascript
let bridges = ['Brooklyn', 'Golden Gate', 'London'];
function logUpperCase(string) {
console.log(string.toUpperCase());
}
bridges.forEach(logUpperCase);
// example 1
function whosASpecial(anArrOfPets) {
@jittdev
jittdev / MemoryOverview-HeapMemory1.txt
Created March 14, 2023 13:57
Memory overview - Heap memory :: #C++
Heap memory allows us to create memory independent of the lifecycle of a function. Heap memory starts at low addresses and grows up.
the only way to create heap memory in C++ is with the NEW operator/keyword.
the new operator returns a POINTER to the memory storing the data - not an instance of the data itself.
new always does 3 things:
[1] allocates memory on the heap for the data structure
[2] initializes the data structure
[3] returns a pointer to the start of the data structure
@jittdev
jittdev / SpecSupportCapybara_Config.Rb1.rb
Created March 14, 2023 13:57
spec/support/capybara_config.rb :: #RSpec
Capybara.register_driver :chrome_headless do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
'goog:chromeOptions': {
args: %w[ no-sandbox headless disable-gpu --window-size=1920,1080]
}
)
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
end
#Ensure Log directory exists
@jittdev
jittdev / RspecCheatsheet1.ini
Created March 14, 2023 13:57
RSpec Cheatsheet :: #RSpec
https://gist.github.com/theoretick/6033200
@jittdev
jittdev / DeviseGemVersion1.rb
Created March 14, 2023 13:56
Devise GEM version :: #Ruby / Rails
gem 'devise', '~> 4.4.3'
@jittdev
jittdev / UsingBackticksToWriteJavascript1.js
Created March 14, 2023 13:56
using backticks to write Javascript :: #Javascript
// function defaultGreet(first, last) {
// if (last !== undefined) {
// return 'Hi ' + first + ' ' + last + '!';
// } else {
// last = ' Doe!';
// return 'Hi ' + first + last;
// }
// }
// defaultGreet('Jane');
@jittdev
jittdev / Mariadb1.txt
Created March 14, 2023 13:56
mariadb :: #VS
// on local server:
brew services restart mariadb
@jittdev
jittdev / FormattingStringsSlicingAndPrintFormatting1.py
Created March 14, 2023 13:56
Formatting Strings/Slicing and PRINT formatting :: #Python Basics
name = 'Johnny'
age = 55
print(f'hi {name}. You are {age} years old') #preferred way in python 3
print('hi {0}. You are {1} years old'.format('Johnny', '55')) #old way
print('hi {new_name}. You are {age} years old'.format(new_name='sally', age=100))
hi Johnny. You are 55 years old