Skip to content

Instantly share code, notes, and snippets.

#!/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))
@rf-
rf- / .gitignore
Last active August 12, 2022 18:33
Repro for automerge-rs#400
node_modules/
@rf-
rf- / validator.rb
Created April 6, 2012 19:57
Demonstrate validation of arbitrary fields (e.g., hstore)
#!/usr/bin/env ruby
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => ':memory:'
)
ActiveRecord::Schema.define do
@rf-
rf- / 00-README.md
Last active March 8, 2019 06:39 — forked from datanoise/crystal-tags.cr
Crystal ctags generator

To compile with Homebrew-installed LLVM:

PATH=/usr/local/opt/llvm/bin:$PATH crystal build crystal-tags.cr
@rf-
rf- / build.sbt
Last active June 25, 2016 01:59
Kalium issue repro
scalaVersion := "2.11.8"
resolvers += "Sonatype" at "https://oss.sonatype.org/content/repositories/releases"
resolvers += "Twitter" at "https://maven.twttr.com/"
libraryDependencies ++= Seq(
"asm" % "asm" % "3.1",
"org.abstractj.kalium" % "kalium" % "0.4.0"
)
require 'rspec/autorun'
module Stuff
def authenticated_as
puts "1: #{self.inspect}"
context 'when there is stuff' do
puts "2: #{self.inspect}"
yield
end
end
# This module defines an alternative to STI where individual types are
# represented by lightweight proxies instead of full models. Each type can have
# its own validations, callbacks, and business logic. In general, client code
# works with the underlying model class directly instead of the type classes,
# but the #as_type method returns a wrapped object that can be used to access
# type-specific logic.
module HasType
INVALID_TYPE_MESSAGE = 'Please choose a valid type'
@rf-
rf- / base.rb
Last active December 19, 2015 16:08
Fragment-caching system for ActiveRecord
# encoding: UTF-8
# Caches::Base is the basis of a system for caching groups of view fragments.
# Classes that inherit from Caches::Base can manage the rendering of a group of
# related fragments (e.g., a list of papers) without wasting any Postgres
# queries or Memcached fetches.
#
# ### Defining A Subclass
#
# A subclass of Caches::Base represents a fragment of content, like a partial
@rf-
rf- / grd
Created February 1, 2013 21:40
#!/usr/bin/env ruby
# grd: micro Guard.
#
# Watch one or more filename patterns and then run the given command every time
# something changes.
#
# Example:
# grd my_model "rspec spec/models/my_model_spec.rb"
@rf-
rf- / .slate
Created January 13, 2013 21:39
# Configs
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
config windowHintsShowIcons true
# Aliases
alias showHintsLeftHand hint 0123456789QAZWSXEDCRFVTGB
# Abstract positions
alias full move screenOriginX;screenOriginY screenSizeX;screenSizeY