Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar
🏠
Working from home

Betty Steger bettysteger

🏠
Working from home
View GitHub Profile
@bettysteger
bettysteger / fusionauth.rb
Last active August 25, 2022 18:28
FusionAuth Omniauth Strategy
View fusionauth.rb
# 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 / sessions_controller.rb
Last active March 21, 2023 12:35
devise-two-factor with devise_token_auth (added line 22-33)
View sessions_controller.rb
# 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 / index.js
Last active October 4, 2018 08:34
Add mailchimp subscriber on Firebase user signup (firebase function)
View index.js
const functions = require('firebase-functions');
const Mailchimp = require('mailchimp-api-v3');
// Listens for new firebase signups
exports.addMailchimpSubscriber = functions.auth.user().onCreate((user) => {
const mailchimp = new Mailchimp('{API-KEY}');
mailchimp.post('/lists/{listID}/members', {
@bettysteger
bettysteger / bitbucket-pipelines.yml
Created July 5, 2018 10:19
Bitbucket Pipeline config to deploy Angular app to Amazon AWS S3 Bucket
View bitbucket-pipelines.yml
image: node:8.7.0
pipelines:
default:
- step:
caches:
- node
script:
- npm install
- npm install yarn grunt -g
@bettysteger
bettysteger / alloyEditor.js
Last active March 21, 2018 09:24
Simple angular wrapper for alloy editor (Angular 1.x component)
View alloyEditor.js
'use strict';
/**
* Alloy editor component
*/
angular.module('myApp').component('alloyEditor', {
template: '<div id="alloyeditor"></div>',
require: {
ngModel: 'ngModel'
},
@bettysteger
bettysteger / app.component.ts
Last active October 20, 2016 08:20
ng-xi18n: Extracts texts and creates a XLIFF file in Angular 2, ready for translation
View app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<h1 i18n>Hello world</h1>
<p i18n="example description">This is an {{details}} paragraph</p>
<p>should not be translated</p>
<p i18n>I ❤ LingoHub</p>
`
})
View angular-file-upload-blob.js
/**
* 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 / trix_editor.css
Last active April 10, 2020 07:23
Trix Editor Toolbar Icons with FontAwesome
View trix_editor.css
trix-toolbar .button_group button::before {
background-image: none !important;
font-family: 'FontAwesome';
font-size: 12px;
line-height: 28px;
}
trix-toolbar .button_group button.bold:before {
content: '\f032';
}
@bettysteger
bettysteger / croppieDrct.js
Last active July 15, 2018 08:02
Croppie Angular Directive for a simple image cropping. Directive => Component: https://github.com/lpsBetty/angular-croppie
View croppieDrct.js
/**
* Use Croppie for a simple image cropping.
* @see https://github.com/Foliotek/Croppie
* @example
* <lh-croppie src="cropped.source" ng-model="cropped.image"></lh-croppie>
*/
angular.module('lingohubApp').directive('lhCroppie', function () {
return {
restrict: 'E',
scope: {
@bettysteger
bettysteger / google_feed_api_deprecated.js
Last active December 2, 2015 09:43
Fetching feed in Angular
View google_feed_api_deprecated.js
// BEFORE
var feedUrl = 'https://lingohub.com/blog/feed/rss2';
$http.jsonp('https://ajax.googleapis.com/ajax/services/feed/load', {params: {v: '1.0', q: feedUrl, num:-1, callback:'JSON_CALLBACK'}}).success(function(data) {
$scope.entries = data.responseData.feed.entries;
angular.forEach($scope.entries, function (entry) {
entry.publishedDate = new Date(entry.publishedDate);
});
});