Skip to content

Instantly share code, notes, and snippets.

View ZASMan's full-sized avatar
🎯
Coding in Ruby as usual.

Zane ZASMan

🎯
Coding in Ruby as usual.
  • DC Metro Area
View GitHub Profile
@ZASMan
ZASMan / my_model_relationships.rb
Last active February 1, 2018 16:54
my_model_relationships.rb
class User < ApplicationRecord
has_many :notebooks, dependent: :destroy
has_one :user_name, foreign_key: "id", dependent: :destroy
# Has an attribute of first_name
# As well as an attribute of last_name
end
class Notebook < ApplicationRecord
belongs_to :user, autosave: true
has_many :email_logs, as: :email_loggable, dependent: :destroy
@ZASMan
ZASMan / squarespace_orange.css
Created February 4, 2018 20:30
squarespace_orange_css
/* This changes the color of the font on the navbar folder items and removes black border from around the dropdown links for folder links*/
.tweak-header-primary-nav-hover-style-fader .Header-nav .Header-nav-folder {
background-color: none;
}
.Header-nav-folder {
border: none;
border: 0;
}
.Header-nav-folder-item {
background-color: rgb(237, 125, 12);
@ZASMan
ZASMan / maros.js
Created September 22, 2018 18:06
code_for_marcos
document.addEventListener("DOMContentLoaded", function(event) {
// ID's should be unique
// Button to click and execute prompt
var my_button = document.getElementById("my_button_id");
// Try adding another element by ID. Such as a div to append the names to
// For example:
// var my_div = document.getElementById("my_div");
// This is attaching a click event function with the function
// buttonAlert to the myButton ID
myButton.addEventListener("click", buttonAlert);
@ZASMan
ZASMan / difference_of_squares.rb
Created December 11, 2018 19:32
Difference of Squares: Exercism/Project Euler problem
class Squares
def initialize(number)
@number = number
end
def square_of_sum
(1..@number).to_a.sum ** 2
end
def sum_of_squares
@ZASMan
ZASMan / series.rb
Created February 19, 2019 18:48
code comparison
# First I had this
class Series
def initialize(numbers)
@numbers = numbers
@numbers_array = numbers.split("").map { |num_string| num_string.to_i }
end
def slices(substring_length)
substring_length = substring_length.to_int
if substring_length > @numbers_array.length