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 / compile_openresty
Last active February 20, 2018 19:45
nginx AAI + user details
# When additional headers need to be forwarded into upstream than lua nginx module should be used.
# The simplest way to have lua support in nginx is to use openresty (https://openresty.org/en/).
# After sources are downloaded and extracted from the archive we can compile openresty
# (or nginx with `lua`, `cjson` and `http_ssl` modules can be compiled):
./configure --prefix=/home/marek/epos/openresty --with-http_ssl_module
make
make install
@mkasztelnik
mkasztelnik / compile_nginx
Last active February 20, 2018 19:18
nginx AAI proxy
# In the scope of first prototype nginx with http_auth_request, http_ssl module is used.
# At the beginning nginx need to downloaded (http://nginx.org/en/download.html), next configured and installed:
./configure --prefix=/home/marek/epos/nginx --with-http_auth_request_module --with-http_ssl_module
make
make install
@mkasztelnik
mkasztelnik / .vimrc.bundles.local
Last active February 29, 2016 07:06
dotfile local changes
Plug 'elixir-lang/vim-elixir'
Plug 'altercation/vim-colors-solarized'
Plug 'janko-m/vim-test'
Plug 'scrooloose/nerdtree'
Plug 'rking/ag.vim'
require './lib/exporters/experiment_exporter'
module Api
module V1
class ExperimentExporterController < Api::ApiController
include ActionController::Live
def show
authorize! :read, :experiment_exporter
# experiment_id = params[:id]
@mkasztelnik
mkasztelnik / gist:8554323
Created January 22, 2014 06:32
SublimeText3 (linux) and guard tests executed while clicking ctr+s
# Add following line into "Settings - User" (Preferences->Settings - User)
"atomic_save": false
@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