Skip to content

Instantly share code, notes, and snippets.

View theisof's full-sized avatar

Theis Frøhlich theisof

  • Aidia
  • Copenhagen
View GitHub Profile
ActionController::UnpermittedParameters at /admin/pages/1
=========================================================
> found unpermitted parameters: icon
actionpack (4.1.6) lib/action_controller/metal/strong_parameters.rb, line 382
-----------------------------------------------------------------------------
``` ruby
377 case self.class.action_on_unpermitted_parameters
RuntimeError at /admin/pages/1
==============================
> #<ActiveModel::Errors:0x007fd3899058a8 @base=#<Widgit::Page id: 1, title: "Test", created_at: "2014-11-23 13:28:36", updated_at: "2014-11-23 13:28:36">, @messages={:"blocks.columns.tile.components"=>["can't be blank"], :"blocks.columns"=>["is invalid"], :blocks=>["is invalid"]}>
/Users/Theis/Documents/GitProjects/widgit-cms/app/controllers/widgit/admin/pages_controller.rb, line 33
-------------------------------------------------------------------------------------------------------
``` ruby
28 respond_to do |format|
@theisof
theisof / gist:2ed7f02766559a61b472
Last active August 29, 2015 14:19
Turbolinks GTM click rule
$(document).on('click', 'a', function(event){
event.preventDefault();
var path = $(this).attr('href');
dataLayer.push({'event':'pageview', 'turbolinksClick': true});
Turbolinks.visit(path);
});
@theisof
theisof / medium-editor.js.coffee
Created August 12, 2015 12:16
React component using Medium editor plugin
<Editor text={@props.image.description} options={{buttons: ['bold', 'italic', 'underline']}} />
Editor = React.createClass
getInitialState: ->
text: this.props.text
getDefaultProps: ->
<div></div>
@theisof
theisof / use-microphone-permission.ts
Created September 26, 2023 19:30
React hook for reading/requesting microphone permission
import { useEffect, useState } from "react";
export type UsePermissionState = "granted" | "denied" | "prompt" | "loading";
export function useMicrophonePermission() {
const [permissionState, setPermissionState] =
useState<UsePermissionState>("loading");
useEffect(() => {
(window.navigator.permissions as any)
.query({ name: "microphone" })
@theisof
theisof / deployment.yml
Created February 29, 2024 19:40
Deploy Next.js on Azure App Service
# build and zip, then...
steps:
- task: AzureRmWebAppDeployment@4
displayName: Publish $(app_name)
inputs:
ConnectionType: "AzureRM"
azureSubscription: "$(azure_subscription)"
appType: "webAppLinux"
WebAppName: "$(app_name)"