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 / SQL-Values.sql.groovy
Created September 19, 2024 00:18
SQL VALUES Data Extractor for Jetbrains DataGrip, Copy table data as formatted SQL `VALUES`
/*
* Adapted from One-row.sql.groovy included with DataGrip
*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col); getTypeName(Object, col); isStringLiteral(Object, col); }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
@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 = '[email protected]'
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 })