Skip to content

Instantly share code, notes, and snippets.

View macowie's full-sized avatar
💫
I will rise up with fists!!

Madeline Cowie macowie

💫
I will rise up with fists!!
View GitHub Profile
@macowie
macowie / yardoc_cheatsheet.md
Created November 2, 2023 04:34 — forked from phansch/yardoc_cheatsheet.md
Improved YARD cheatsheet
@macowie
macowie / offline_backup.sh
Last active February 1, 2023 06:01
Online backup of my offline backup script
#!/bin/sh
set -e
# Simple backup script for offline drives
# Keep a copy on drive with a sources.txt listing the paths this drive should backup
# /mnt/Milpool/Media/Music
# /mnt/Milpool/appdata_backups
# ...
SCRIPT_PATH=$(dirname $(realpath "$0"))
@macowie
macowie / copydisc.sh
Created December 27, 2022 17:32
Copy disc to ISO
#! /bin/sh
set -e
# Copy disc to ISO script. I believe everyone has to write one of these at some point
input=${1:-/dev/sr0}
info=$(isoinfo -d -i $input)
volume_id=$(echo "$info" | awk '/Volume id/' | awk '{print $NF}')
@macowie
macowie / LSP.sublime-settings
Last active June 7, 2020 20:25
SublimeText Prefs
{
"clients":
{
"ruby":
{
"enabled": true
},
"rls":
{
@macowie
macowie / RSpec.sublime-build
Created June 6, 2020 20:01
SublimeText Build - Terminus - RSpec
{
"cmd": ["rspec"],
"file_regex": "# ([A-Za-z:0-9_./ ]+rb):([0-9]+)",
"working_dir": "${project_path}",
"selector": "source.ruby.rspec",
"target": "terminus_exec",
"env": {
"RAILS_SYSTEM_TESTING_SCREENSHOT": "inline"
},
"variants": [
@macowie
macowie / paperclip_image_input.rb
Created February 24, 2016 17:31
Basic Formtastic Input for working with Paperclip image attachments
class PaperclipImageInput < Formtastic::Inputs::FileInput
def image_html_options
{:class => 'attachment'}.merge(options[:image_html] || {})
end
def to_html
input_wrapping do
label_html <<
image_html <<
builder.file_field(method, input_html_options)
@macowie
macowie / gitlab_migration.rb
Last active August 29, 2015 14:25
Quick 'n Dirty Gitlab Import script
#!/usr/bin/env ruby
require 'httparty'
require 'json'
LEGACY_GIT = 'git@youroldgit.com'
GITLAB_URL = "hostname.yourdomain.com"
TOKEN = "YOUR_GITLAB_API_TOKEN"
DEFAULT_HTTP_OPTIONS = { headers: { 'Content-Type' => 'application/json' } }
@macowie
macowie / draftable.rb
Created March 1, 2014 22:30
Simple drafting module mixin
# column boolean :drafted
# Draftable.options_for_select collection for form
# Objects default to published unless explicitly set to drafted
module Draftable
extend ActiveSupport::Concern
included do
scope(:published, lambda { where drafted: [false, nil] })
scope(:drafted, lambda { where drafted: true })