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 / TodoForm.js
Created May 20, 2020 00:12
In Place Updates For React App
import React, { Component } from "react"
import TextField from '@material-ui/core/TextField'
import Button from '@material-ui/core/Button'
import Grid from "@material-ui/core/Grid"
import TextareaAutosize from "@material-ui/core/TextareaAutosize"
class TodoForm extends Component {
constructor(props) {
super(props)
// Overhauled this, defaults now come from todo list.
<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;
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
/*
* 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.
# 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}")
# 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
@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.
*/
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) {
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
[{"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