Skip to content

Instantly share code, notes, and snippets.

View DevGW's full-sized avatar
🔥
building ... things!

JB (DevGW) DevGW

🔥
building ... things!
View GitHub Profile
@DevGW
DevGW / AosElementAnimation1.txt
Created December 29, 2022 13:43
AOS element animation
// from the Node library: aos
// syntax
<div
data-aos="fade-up"
data-aos-offset="200"
data-aos-delay="50"
data-aos-duration="1000"
data-aos-easing="ease-in-out"
data-aos-mirror="true"
data-aos-once="false"
@DevGW
DevGW / AddingAModuleToRailsProject1.rb
Last active March 3, 2023 16:18
Ruby / Rails :: Adding a module to rails project #hha_ank
# Module can be used by any controller instead of helper.rb which is only for associated controller
### make sure to add
### config.autoload_paths += %W(#{config.root}/lib)
### to config/application.rb
# and don't forget to make the file in /lib/ with this format: modelname.rb
module MODULENAME
    def METHODNAME
    end
@DevGW
DevGW / RakeTask1.rb
Last active March 3, 2023 15:41
Ruby / Rails :: rake task #hha_ank
namespace :NAMESPACE do
desc "ENTER DESCRIPTION HERE"
task :start => [ :environment ] do
end #end task
end
### to run from shell "rails task_name"
@DevGW
DevGW / GemInstallLocation1.rb
Created December 29, 2022 13:43
Ruby / Rails :: gem install location
bundle install --path vendor/bundle
@DevGW
DevGW / Cheatsheet1.rb
Created December 29, 2022 13:43
Capybara :: cheatsheet
#Navigating
visit articles_path
#Clicking links and buttons
click_on 'Link Text'
click_button
click_link
#Interacting with forms
attach_file 'Image', '/path/to/image.jpg'
@DevGW
DevGW / SignChirp.App1.rb
Created December 29, 2022 13:43
shell :: sign chirp.app
codesign --force --deep --sign - /Applications/CHIRP.app
@DevGW
DevGW / RecursionIiArraysAndObjects1.js
Created December 29, 2022 13:43
Javascript :: Recursion II Arrays and Objects
// adding all the elements of a limitless nested array
function arraySum(anArr) {
let sum = 0;
for (let i = 0; i < anArr.length; i++) {
let element = anArr[i];
if (Array.isArray(element)) {
sum += arraySum(element);
} else
sum += element;
} return sum;
@DevGW
DevGW / ForLoopVsWhileLoop1.js
Created December 29, 2022 13:43
Javascript :: for loop vs while loop
// loop through string
let letters = 'abcdefg';
// initial: let i=0
// conditional: i<letters.length
// final: i++
for (let i=0; i < letters.length; i++) {
let currentLetter = letters[i];
console.log(currentLetter);
@DevGW
DevGW / NewGem,PluginOrEngine1.rb
Created December 29, 2022 13:43
Ruby / Rails :: New Gem, Plugin or Engine
### GEM
rails gem new GEM_NAME
### PLUGIN / ENGINE
### use for rails extensions that don't require
### full application-like setup. but,
### since it's still a rails-specific setup
rails plugin new PLUGIN_NAME
### options for plugin
@DevGW
DevGW / Form-Select_Tag1.rb
Created December 29, 2022 13:43
Ruby / Rails :: form - select_tag
<%= select_tag "NAME", options_for_select(@options, @selected_options), id: "ID_NAME" %>