Skip to content

Instantly share code, notes, and snippets.

View Deanout's full-sized avatar
💭
Should be sleeping.

Dean DeHart Deanout

💭
Should be sleeping.
View GitHub Profile
@Deanout
Deanout / Blocks, Procs, Demos video
Created May 31, 2023 04:54
Code for a quick little Ruby tutorial.
new_line = "____________________________\n"
# Blocks
puts "Blocks"
my_numbers = [1, 2, 3, 4, 5]
my_numbers.each {
|number|
puts "Printing the number: #{number}"
[{"regionId":14676,"regionX":33,"regionY":36,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":38,"regionY":32,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":40,"regionY":36,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":38,"regionY":31,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":40,"regionY":27,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":33,"regionY":27,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":32,"regionY":27,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":27,"regionY":31,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":32,"regionY":36,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":27,"regionY":32,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":25,"regionY":36,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":25,"regionY":27,"z":1,"color":"#9C7C7C7C"},{"regionId":14676,"regionX":29,"regionY":23,"z":1,"color":"#9C7C7C7C","label":"attack"},{"regionId":14676,"regionX":25,"regionY":29,"z":1,"color":"#9C7C7C7C","label":"atta
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg
echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt update
sudo apt install elasticsearch
# You'll need to edit this one twice, once to set the host and port, and once to set xpack security to false.
sudo nano /etc/elasticsearch/elasticsearch.yml
sudo nano /etc/wsl.conf
sudo systemctl start elasticsearch
import { useState, useEffect } from 'react';
import { createPicker } from 'picmo';
function EmojiPicker() {
const [chosenEmoji, setChosenEmoji] = useState('');
let emojiPicker;
useEffect(() => {
emojiPicker = document.querySelector('.pickerContainer');
if (emojiPicker === null) {
@Deanout
Deanout / drag_controller.js
Created July 6, 2022 10:08
Stimulus Drag & Drop controller, covered in Deanin's Drag and Drop Rails tutorial
import { Controller } from "@hotwired/stimulus";
/**
* The data attribute containing the draggable element's id.
*/
const dataResourceID = "data-resource-id";
/**
* The data attribute containing the draggable element's outer parent,
* to prevent traversing up to the document root.
*/
# frozen_string_literal: true
# All Devise controllers are inherited from here.
class DeviseController < Devise.parent_controller.constantize
include Devise::Controllers::ScopedViews
if respond_to?(:helper)
helper DeviseHelper
end
# SIGN UP
uri = URI("https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=#{Rails.application.credentials.firebase_api_key}")
# LOGIN
uri = URI("https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=#{Rails.application.credentials.firebase_api_key}")
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS
* files in this directory. Styles in this file should be added after the last require_* statement.
bundle add devise
bundle install
rails g devise:install
class TurboDeviseController < ApplicationController
class Responder < ActionController::Responder
def to_turbo_stream
controller.render(options.merge(formats: :html))
rescue ActionView::MissingTemplate => error
<style scoped>
.sm-title {
font-size: 2.5rem;
font-weight: bold;
text-align: center;
font-family: "Roboto", sans-serif;
}
.container {
width: 90%;
margin: 0 auto;