Skip to content

Instantly share code, notes, and snippets.

View sirbrillig's full-sized avatar

Payton Swick sirbrillig

View GitHub Profile
@sirbrillig
sirbrillig / quicklist.vim
Last active December 31, 2015 07:39
A vimL class to open a file list buffer.
function! OpenQuickList(data)
silent! botright 10split __QuickList__
normal! ggdG
setlocal buftype=nofile
setlocal bufhidden=delete
setlocal noswapfile
setlocal nowrap
setlocal nobuflisted
@sirbrillig
sirbrillig / netgrep.vim
Last active December 29, 2015 04:49
vim NetGrep function for grepping on a remote server
function! RunNetGrep(pattern, ...)
let tmpfile = tempname()
if exists('g:NetGrep_server_name') && exists('g:NetGrep_default_directory')
let server_name = g:NetGrep_server_name
let default_directory = g:NetGrep_default_directory
else
echom "Error: NetGrep requires g:NetGrep_server_name and g:NetGrep_default_directory"
return
endif
@sirbrillig
sirbrillig / Vagrantfile
Created April 21, 2013 22:37
Vagrantfile for local Ubuntu server with puppet and librarian-puppet.
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :public_network
config.vm.provision :shell, :path => "deploy-puppet.sh"
config.vm.provision :puppet do |puppet|
puppet.module_path = "modules"
puppet.manifests_path = "manifests"
end
end
@sirbrillig
sirbrillig / Vagrantfile
Created April 17, 2013 17:06
Vagrantfile for Rackspace Ubuntu with Puppet
Vagrant.configure("2") do |config|
config.vm.box = "dummy"
config.ssh.private_key_path = "PRIVATE_KEY"
config.vm.provider :rackspace do |rs|
rs.username = "USER"
rs.api_key = "KEY"
rs.flavor = /512MB/
rs.image = /Ubuntu/
@sirbrillig
sirbrillig / Puppetfile
Last active March 8, 2018 19:43
Puppet Wordpress manifest
forge "http://forge.puppetlabs.com"
mod 'hunner/wordpress'
mod 'puppetlabs/apache'
mod 'b0d0nne11/vim'
@mixin bleed($padding: $grid-padding, $sides: left right) {
@if $sides == 'all' {
margin: - $padding;
padding: $padding;
} @else {
@each $side in $sides {
margin-#{$side}: - $padding;
padding-#{$side}: $padding;
}
}
@sirbrillig
sirbrillig / select2_helper.rb
Created March 6, 2013 04:47
Capybara select2 fill_in helper (for eg: autocomplete).
def fill_in_select2(selector, options={})
page.find(:css, "#s2id_#{selector} a").click
page.find(:css, ".select2-search input.select2-input").set options[:with]
page.find(:css, ".select2-result-label").click # Choose the first result
end
@sirbrillig
sirbrillig / pgsql_backup.sh
Last active November 15, 2024 14:57 — forked from dangerousbeans/pgsql_backup.sh
Postgresql daily backup script.
#!/bin/bash
#
# Backup a Postgresql database into a daily file.
#
BACKUP_DIR=/pg_backup
DAYS_TO_KEEP=14
FILE_SUFFIX=_pg_backup.sql
DATABASE=
USER=postgres
@sirbrillig
sirbrillig / Rakefile
Last active December 11, 2015 04:28
Rake tasks for deploying middleman to github pages (inspired by http://stackoverflow.com/questions/11809180/middleman-and-github-pages)
desc "build website"
task :build do
system "rm -rf build/*"
system "middleman build"
puts "## Build complete"
puts "To deploy, see the deploy task."
puts <<-eos
## If this is your first deploy and the gh-pages branch does not exist, run the following:
@sirbrillig
sirbrillig / gist:4499620
Created January 10, 2013 05:06
Overflow a CSS background-image.
#wrapper {
background-image: url("image.png");
width: 80px; /* the image width is 100px; */
padding-right: 20px;
margin-right: -20px;
}