Skip to content

Instantly share code, notes, and snippets.

View imomaliev's full-sized avatar

Sardorbek Imomaliev imomaliev

View GitHub Profile
dhh / pagination_controller.js
Last active April 24, 2024 10:53
HEY's Stimulus Pagination Controller
ERB template chunk from The Feed's display of emails:
<section class="postings postings--feed-style" id="postings"
data-controller="pagination" data-pagination-root-margin-value="40px">
<%= render partial: "postings/snippet", collection: @page.records, as: :posting, cached: true %>
<%= link_to(spinner_tag, url_for(page: @page.next_param),
class: "pagination-link", data: { pagination_target: "nextPageLink", preload: @page.first? }) unless @page.last? %>
lbiaggi / ltex.lua
Last active June 13, 2024 09:17
ltex-ls support WIP
--- BEFORE USING, change language entries to fit your needs.
local lspconfig = require'lspconfig'
local configs = require'lspconfig/configs'
local util = require 'lspconfig/util'
local Dictionary_file = {
["pt-BR"] = {vim.fn.getenv("NVIM_HOME") .. "spell/dictionary.txt"} -- there is another way to find ~/.config/nvim ?
local DisabledRules_file = {
Finndersen /
Last active August 29, 2023 12:53
PolymorphicRelatedQuerySet which allows select_related() to return polymorphic child models instead of base model
nckroy /
Created January 21, 2021 00:15
OAuth 2.0 and the Road to Hell

(Scraped from the Internet Wayback Machine. Original content by Eran Hammer / July 26, 2012)

OAuth 2.0 and the Road to Hell

They say the road to hell is paved with good intentions. Well, that’s OAuth 2.0.

Last month I reached the painful conclusion that I can no longer be associated with the OAuth 2.0 standard. I resigned my role as lead author and editor, withdraw my name from the specification, and left the working group. Removing my name from a document I have painstakingly labored over for three years and over two dozen drafts was not easy. Deciding to move on from an effort I have led for over five years was agonizing.

There wasn’t a single problem or incident I can point to in order to explain such an extreme move. This is a case of death by a thousand cuts, and as the work was winding down, I’ve found myself reflecting more and more on what we actually accomplished. At the end, I reached the conclusion that OAuth 2.0 is a bad

// Modified from @mutsuda's
// by @levelsio
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = ""
// 4) Install Scriptable @
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
hakib /
Created March 30, 2020 15:10
Using Markdown in Django
# Source code for article:
from typing import Optional
import re
import markdown
from markdown.inlinepatterns import LinkInlineProcessor, LINK_RE
from urllib.parse import urlparse
from django.core.exceptions import ValidationError
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
bbqtd /
Last active June 14, 2024 17:47
Installing tmux-256color for macOS

Installing tmux-256color for macOS

  • macOS 10.15.5
  • tmux 3.1b

macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.

The Fast Blazing Solution

Instead of tmux-256color, use screen-256color which comes with system. Place this command into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later):

edwinlee /
Last active February 21, 2024 10:43
Sync a Google Sheets spreadsheet to a Firebase Realtime database
* Copyright 2019 Google LLC.
* SPDX-License-Identifier: Apache-2.0
function getEnvironment() {
var environment = {
fl64 / docker-mod.yml
Created April 4, 2019 16:05
Ansible playbook for modifying /etc/docker/daemon.json config (based on
- hosts: all
become: yes
gather_facts: false
- name: Check that the /etc/docker/daemon.json exists
path: /etc/docker/daemon.json
register: stat_result