Skip to content

Instantly share code, notes, and snippets.

//This mixin adds font with name $name which is in $path folder.
//In my case this is "../fonts/FONT-NAME/"
//Usage: just add @include add-font(FONT-NAME)
@mixin add-font($name, $weight:"normal", $style:"normal")
$path: "../fonts/" + $name + "/"
@font-face
font-family: quote($name)
src: url($path + $name + ".eot")
src: url($path + $name + ".eot?#iefix") format('embedded-opentype'),
url($path + $name + ".woff") format('woff'),
module Api
class BaseController < ApplicationController
include Pundit
acts_as_token_authentication_handler_for User, unless: :no_authentication_required
def no_authentication_required
self._process_action_callbacks.map(&:filter).compact.include? :no_authentication_required
end
end
@k0va1
k0va1 / Gemfile
Created December 22, 2018 18:38
Gemfile template for new gem
source 'https://rubygems.org'
gemspec
@k0va1
k0va1 / like_current_song.sh
Last active October 24, 2020 16:50
Like your currently playing track in Spotify
#! /bin/bash
spotify_tokens_file="$HOME/.config/spotify_token_info.json"
spority_credentials_file="$HOME/.config/spotify_credentials.json"
client_id=$(jq -r '.client_id' $spority_credentials_file)
client_secret=$(jq -r '.client_secret' $spority_credentials_file)
port=8082 # you need to set redirect uri like http://localhost:8082/
redirect_uri=http%3A%2F%2Flocalhost%3A$port%2F
@k0va1
k0va1 / content.md
Created October 24, 2020 15:59 — forked from jonathannerat/content.md
Fix for corrupted screen and icons after suspend on systems with nvidia propietary drivers

This is done with an option when you load the module: modprobe nvidia NVreg_RegisterForACPIEvents=1 NVreg_EnableMSI=1

To automatically use this option, create a file named /etc/modprobe.d/50-nvidia.conf with the following content:

options nvidia NVreg_RegisterForACPIEvents=1 NVreg_EnableMSI=1

Restart your machine and now you can safely suspend and resume without screen corruption. In my case in 9 out of 10 suspend operations this fixes the screen corruption issue. Very rarely it still happens, but much less often than without this options.

import { Controller } from "@hotwired/stimulus"
import lightGallery from "lightgallery";
export default class extends Controller {
connect() {
this.initPhotoGalleries();
}
initPhotoGalleries() {
const container = document.getElementById('post__gallery_container')