Note: I didn't use AI to write this. I originally had it try to analyze the profiler GC logs, but there wasn't enough information for it to be conclusive (see below).
| -- https://github.com/jhawthorn/fzy/pull/116#issuecomment-538708329 | |
| local function fzy(a) | |
| local saved_spk = vim.o.splitkeep | |
| local src_winid = vim.fn.win_getid() | |
| -- lines >= 3 is a hardcoded limit in fzy | |
| local fzy_lines = (vim.v.count > 2 and vim.v.count) or 10 | |
| local tempfile = vim.fn.tempname() | |
| local term_cmd = a.input .. ' | fzy -l' .. fzy_lines .. ' > ' .. tempfile | |
| -- FIXME: terminal buffer shows in `:ls!` after exiting. |
Although @setup/node as a built-in cache option, it lacks an opportunity regarding cache persistence. Depending on usage, the action below might give you faster installs and potentially reduce carbon emissions (♻️🌳❤️).
Yarn 3+/4+ with nodeLinker: node-modules. (Not using yarn ? see the corresponding pnpm 7/8+ action gist)
| local ls = require("luasnip") | |
| local fmt = require("luasnip.extras.fmt").fmt | |
| local s = ls.snippet | |
| local i = ls.insert_node | |
| local f = ls.function_node | |
| local d = ls.dynamic_node | |
| local sn = ls.snippet_node | |
| local rep = require("luasnip.extras").rep | |
| -- Get a list of the property names given an `interface_declaration` |
In order to keep filters up to date, please use this repo.
This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.
Convert .mov/.MP4 to .gif
As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.
This is not limited to developer, anyone has this need can use this method to convert the files.
| import asyncio | |
| import async_timeout | |
| import concurrent.futures | |
| import random | |
| import time | |
| async def produce(queue, n): | |
| for x in range(n): | |
| # produce an item |
| #!/usr/bin/env python | |
| import pynvim, os, re, sys, time | |
| # Get a list of buffers that haven't been deleted. `nvim.buffers` includes | |
| # buffers that have had `:bdelete` called on them and aren't in the buffer | |
| # list, so we have to filter those out. | |
| def get_listed_buffers(nvim): | |
| return set(buf.number for buf in nvim.buffers \ | |
| if nvim.eval('buflisted(%d)' % buf.number)) |
| class PriorityQueue | |
| attr_reader :elements | |
| def initialize | |
| @elements = [nil] | |
| end | |
| def <<(element) | |
| @elements << element | |
| bubble_up(@elements.size - 1) |
| namespace :db do | |
| desc "Backs up heroku database and restores it locally." | |
| task import_from_heroku: [ :environment, :create ] do | |
| HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote. | |
| c = Rails.configuration.database_configuration[Rails.env] | |
| heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil | |
| Bundler.with_clean_env do | |
| puts "[1/4] Capturing backup on Heroku" | |
| `heroku pg:backups capture DATABASE_URL#{heroku_app_flag}` |