Skip to content

Instantly share code, notes, and snippets.

View mkasztelnik's full-sized avatar

Marek Kasztelnik mkasztelnik

  • ACK Cyfronet AGH
  • Kraków
View GitHub Profile
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static classes = ['highlight']
connect () {
this.element
.querySelector(`a[name='${window.location.hash.slice(1)}']`)
?.parentElement?.classList?.add(...this.highlightClasses)
}
@mkasztelnik
mkasztelnik / global.rb
Created November 15, 2012 15:00 — forked from colinsurprenant/global.rb
shared global ruby configuration dsl example
module App
module Global
extend self
def self.configure(&block)
instance_eval(&block)
end
def [](key)
config[key]
@mkasztelnik
mkasztelnik / oauth_controller.rb
Created November 8, 2012 13:51 — forked from dblock/oauth_controller.rb
An updated OAuth2 controller for a Rails app (implies you have ClientApplication and AccessGrant)
class OauthController < ApplicationController
class ApiOAuthError < StandardError
attr_accessor :code, :description, :uri, :state
def initialize(code, description, uri = nil, state = nil)
@code = code
@description = description
@uri = uri