Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott McMillin scottymac

View GitHub Profile
@scottymac
scottymac / lucky_crud.cr
Created Nov 20, 2018
Lucky Framework (Crystal) Basic CRUD setup
View lucky_crud.cr
# MODEL
class Foo < BaseModel
table :foos do
column name : String
end
end
# FORM
class FooForm < Foo::BaseForm
fillable name
View Instagram to Feedbin using RSSHub bookmarklet
var current_url = window.location.href;
var feedbin_url = "https://feedbin.me/?subscribe="
var inst_regex = new RegExp("https:\/\/www\.instagram\.com\/(.*)\/");
var inst_username = inst_regex.exec(current_url)[1];
if (inst_username !== "" || inst_username !== undefined) {
var feed_url = "https://rsshub.app/instagram/user/" + inst_username;
window.location = feedbin_url + feed_url;
}
// The bookmarklet
View gist:d155fb0d1cafb14fa397ca8f4e29c4ad
Verifying my Blockstack ID is secured with the address 1C6zqdybJmBASXyRvxUeTpDWjeEodyHykQ https://explorer.blockstack.org/address/1C6zqdybJmBASXyRvxUeTpDWjeEodyHykQ
View IconServiceAgent.md

I was chasing down another issue (slow "Save As") and thought these two issues may have been related (with QuickLook being the common broken link). Unfortunately, my "Save As" dialog is still miserably slow on the initial load; but IconServicesAgent hasn't gone above 30MB and he rarely makes an appearance in the Console!

Some of these steps may not be necessary, but here are all of the steps I took that inadverdently put IconServicesAgent back in its place. Note: all commands are a single-line, if they appear to be multiple that's just the forum formatting.

  1. Check for any QuickLooks related .plist files. In a terminal: mdfind com.apple.quicklook. -name .plist

  2. I only had files at the system level (specifically within /System/Library/LaunchAgents/). If you have others, modify the directions below to take that into account (re-introducing plist files from the system level back up to the user).

  3. Make some temporary directories to store these plist files, just in case: mkdir ~/tmp-quicklook

View Mediator-State Pattern (Swift 4)
The MIT License
Copyright (c) 2015-2017 Scott McMillin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View Events.cs
using System.Collections;
using System.Collections.Generic;
public class GameEvent
{
}
public class Events
{
static Events instanceInternal = null;
@scottymac
scottymac / Postgres Cast an Array Column for Comparison
Last active Aug 29, 2015
Postgres Cast an Array Column for Comparison
View Postgres Cast an Array Column for Comparison
-- datetimes is an array column of strings (b/c ActiveRecord doesn't support arrays of datetimes just yet (but soon))
-- This is doing a date comparison
SELECT * FROM table WHERE now() ANY (CAST(datetimes as timestamp[]))
in ActiveRecord:
scope :past, lambda {
where(":now > ALL (CAST(datetimes as timestamp[]))", { now: Time.zone.now })
}
View Keybase.md

Keybase proof

I hereby claim:

  • I am scottymac on github.
  • I am scottymac (https://keybase.io/scottymac) on keybase.
  • I have a public key whose fingerprint is 36A4 DC4D 2E93 A124 8936 3E78 3BEA 3029 2C1D 2805

To claim this, I am signing this object:

View gist:6539442
class UITextView #(Extensions) https://gist.github.com/brentsimmons/5810992/
def stringCharacterIsAllowedAsPartOfLink(s)
if (s == nil || s.length < 1)
return false
end
ch = s.characterAtIndex(0)
if NSCharacterSet.whitespaceAndNewlineCharacterSet.characterIsMember(ch)
return false
end
View XDSpinner.h
//
// XDSpinner.h
// Sparrow 2.X
//
// Created by Shilo White on 8/17/13.
// Copyright (c) 2013 XIDA Design & Technik. All rights reserved.
//
#import "SPDisplayObjectContainer.h"
You can’t perform that action at this time.