Skip to content

Instantly share code, notes, and snippets.

View blairanderson's full-sized avatar

Blair Anderson blairanderson

View GitHub Profile
@blairanderson
blairanderson / instructions.md
Created October 30, 2020 20:38
[Fixed] Atom does not quit on OS X (screenshots)

This was incredibly annoying, but I found the results deep on a github issue: atom/atom#17672 (comment)

Instructions:

  1. Open Security & Privacy
  2. In the bottom-left corner, Unlock to make changes
  3. In the left panel, scroll down to Full Disk Access
  4. In the right panel, scroll down to find Atom and check the box.
  5. Close down the security settings panel
  6. Force-Quit Atom, by holding control + option before clicking the atom icon
@blairanderson
blairanderson / bs_toast.js
Last active May 21, 2022 19:32
Bootstrap 5 : jQuery Toast Builder
var toastIDCounter = 0;
(function ($) {
$.fn.bsToast = function (options) {
if (typeof options === "string") {
options = {
body: options
}
}
var settings = $.extend({
@blairanderson
blairanderson / cleanup.rb
Created August 22, 2020 20:13
just some nasty file cleanup for an old computer
require 'fileutils'
Dir.glob('/Documents/dev/*').each do |directory|
dir = directory.split("/").last
next if File.file?(dir)
is_git = false
git_remote = ""
has_changes = false
message = ""
@blairanderson
blairanderson / debugging-your-startup.md
Created August 11, 2020 22:05
Debugging Your Startup - Justin Khan at atrium.co (blog now defunct)
@blairanderson
blairanderson / fetch.rake
Last active July 22, 2020 18:34
Rakefile for fetching the current dist/sass/etc folders from the bootstrap and tachyons GitHub repository
namespace :fetch do
desc "fetch tachyons scss files"
task :tachyons do
`curl -LkSs https://github.com/tachyons-css/tachyons-sass/archive/v4.7.1.tar.gz | tar xz`
`mv -f ./tachyons-sass-*/scss ./_sass/tachyons-sass`
`mv -f ./tachyons-sass-*/tachyons.scss ./_sass/tachyons-sass`
`rm -rf ./tachyons-sass-*`
end
desc "fetch bootstrap scss files"
@blairanderson
blairanderson / extract.rb
Created May 14, 2020 18:32
write JSON file data to multiple files [ruby]
require 'active_support'
require 'active_support/core_ext'
require 'json'
JSON.parse(File.open("./_data/companies.json").read).each do |company|
File.open("./_companies/#{company['name'].parameterize}.md", "w") do |f|
f.write "---\n"
f.write "layout: company\n"
f.write "title: #{company['name']}\n"
f.write "categories: prep\n"
@blairanderson
blairanderson / gist:f0b49fb84abfb56e32f13395ddba0196
Created March 5, 2020 01:20
idea for rails ETL with ActiveStorage
class HighAvailabilityETL < RailsFoo
has_one_attached :input
has_one_attached :translate_step1
has_one_attached :translate_step2
has_one_attached :translate_step3
has_one_attached :output
def runner
step1_errors = input_to_translate_step1! unless input.attached?
step2_errors = step1_to_step2! unless translate_step1.attached?
@blairanderson
blairanderson / gist:40eb58d41a7f8a4271f01e3453b69154
Created November 7, 2019 20:54
DIRECT FULFILMENT (lead time calculation)
1. download all orders from https://vendorcentral.amazon.com/hz/vendor/members/df/orders
2. Move column Y to column E
3. Remove timezone string from the columns D & E
4. column F =ROUND(24*(E2-D2),1)
@blairanderson
blairanderson / transfer.rb
Created November 5, 2019 19:00
Ruby / Rails transfer files from SFTP to FTP folder
# ftp_uri is calculated from environment variable and database encrypted account/password
class Transfer
def transfer
require 'net/sftp'
require 'net/ftp'
current_business = Business.find(business_id)
old_directory = "/orders/"
directory = "orders"
sftpuri = current_business.sftp_uri

Keybase proof

I hereby claim:

  • I am blairanderson on github.
  • I am blairanderson (https://keybase.io/blairanderson) on keybase.
  • I have a public key ASBO7gg1K05ibXO41y3bjm2-S6xY6ixX2Zft1TXd2wJNkwo

To claim this, I am signing this object: