Skip to content

Instantly share code, notes, and snippets.

View bettysteger's full-sized avatar
🏠
Working from home

Betty Steger bettysteger

🏠
Working from home
View GitHub Profile
@bettysteger
bettysteger / Editorjs.vue
Last active June 26, 2024 20:56
Vue 3 SFC for Editor.js using v-model with own custom vue component
<template>
<div class="editorjs" ref="htmlelement"></div>
</template>
<script setup>
import EditorJS from '@editorjs/editorjs';
import EmbedTool from '@editorjs/embed';
import ListTool from '@editorjs/list';
import ImageTool from '@editorjs/image';
import VideoTool from './editorjs/video.js';
import { onMounted, onUnmounted, ref, watch } from 'vue';
@bettysteger
bettysteger / editorjs-embed.js
Last active June 3, 2024 09:52
Editorjs: Overwrite Embed Block Tool to show an input field where you can paste the URL
// Overwrite Embed Block Tool
import EmbedTool from '@editorjs/embed';
export default class Embed extends EmbedTool {
static get toolbox() {
return {
title: 'YouTube',
icon: '<i class="fab fa-youtube"></i>'
};
}
@bettysteger
bettysteger / init-editorjs.js
Last active April 7, 2024 08:13
Editor.js [Inline Tool] Mentions
import mentionsService from 'mentionsService.js'
import InlineMention from 'inlineMention.js'
/**
* this is just a code snippet on how to use the Mentions Service and Inline Tool
*/
const editor = new EditorJS({
holder: 'editorjs',
inlineToolbar: ['bold', 'italic', 'link', 'inlineMention'],
tools: {
@bettysteger
bettysteger / sessions_controller.rb
Last active September 27, 2023 20:28
devise-two-factor with devise_token_auth (added line 22-33)
# Need to overwrite controller to make a devise-two-factor work with devise_token_auth
# @see https://github.com/lynndylanhurley/devise_token_auth/blob/master/app/controllers/devise_token_auth/sessions_controller.rb
class SessionsController < DeviseTokenAuth::SessionsController
def create
# Check
field = (resource_params.keys.map(&:to_sym) & resource_class.authentication_keys).first
@resource = nil
if field
@bettysteger
bettysteger / fusionauth.rb
Last active August 25, 2022 18:28
FusionAuth Omniauth Strategy
# lib/strategies/fusionauth.rb
require 'omniauth-oauth2'
module OmniAuth
module Strategies
class Fusionauth < OmniAuth::Strategies::OAuth2
# Give your strategy a name.
option :name, "fusionauth"
# This is where you pass the options you would pass when
@bettysteger
bettysteger / bitbucket-pipelines.yml
Created July 5, 2018 10:19
Bitbucket Pipeline config to deploy Angular app to Amazon AWS S3 Bucket
image: node:8.7.0
pipelines:
default:
- step:
caches:
- node
script:
- npm install
- npm install yarn grunt -g
@bettysteger
bettysteger / 1modalStateProvider.js
Last active December 3, 2020 17:22
Bootstrap Modal window with custom URL in AngularJS (ui.bootstrap.modal with ui-router)
/**
* Modal provider. Adds state which will open a modal.
* Opens or closes modal on URL change.
*/
app.provider('modalState', function($stateProvider) {
var provider = this;
var modalResult;
this.$get = function() {
return provider;
};
/**
* Show preview of cropped image
*/
uploader.onAfterAddingFile = function(item) {
$scope.cropped = {image: ''};
var reader = new FileReader();
reader.onload = function(event) {
$scope.$apply(function(){
$scope.cropped.image = event.target.result;
});
@bettysteger
bettysteger / es6-classes-inheritance.js
Last active October 11, 2020 00:05
ES6 Classes and Inheritance example (www.es6fiddle.net)
/**
* Classes and Inheritance
* Code Example from http://www.es6fiddle.net/
*/
class Polygon {
constructor(height, width) { //class constructor
this.name = 'Polygon';
this.height = height;
this.width = width;
}
@bettysteger
bettysteger / bookmarklet.js
Last active May 19, 2020 05:53
howto make an angular app with a JS bookmarklet
/**
* redirect javascript bookmarklet
*/
// javascript:location.href='http://example.com/?uri='+encodeURIComponent(location.href)
/**
* bookmarklet loaded on site
*/
(function(){