Skip to content

Instantly share code, notes, and snippets.

View mhulse's full-sized avatar
👋
👁 ❤️ open source software …

Michael Hulse mhulse

👋
👁 ❤️ open source software …
  • Instructure Inc.
  • Eugene, Oregon
View GitHub Profile
@mhulse
mhulse / fromhex.bash
Last active March 13, 2024 22:15
Bash function to convert hex to 256 terminal color.
# fromhex A52A2A
# fromhex "#A52A2A"
# BLUE_VIOLET=$(fromhex "#8A2BE2")
# http://unix.stackexchange.com/a/269085/67282
function fromhex() {
hex=$1
if [[ $hex == "#"* ]]; then
hex=$(echo $1 | awk '{print substr($0,2)}')
fi
r=$(printf '0x%0.2s' "$hex")
@mhulse
mhulse / SelectActiveLayers.jsx
Last active December 10, 2023 00:50
Adobe Illustrator script to select highlighted layers. Written by @Qwertyfly and only slightly modified by me. Original code and discussion can found here: https://forums.adobe.com/message/8328893
#target illustrator
function make() {
var name = 'temp'; // Action name.
var set = 'temp'; // Set name.
var level = app.userInteractionLevel;
var action;
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
@mhulse
mhulse / Setting up Google Cloud Storage with CORS for Web Fonts.md
Last active August 5, 2023 19:17
Setting up CORS on Google Cloud Storage: An unofficial quick start guide to serving web fonts from Google's cloud. (I'm sure a lot of this info could be improved... Please leave comments if you have tips/improvements.)

Login:

Google Cloud Storage

You'll want to login using an official Google account (i.e. if this is for your company, use the comapany Gmail account vs. a personal one.)

When logging in, you might be prompted to verify the account; if so, enter your cell number to get a verification e-mail or phone call.

Once verified, you'll have to agree to the terms of service; do that, and click continue.

@mhulse
mhulse / ssh tunneling.md
Last active July 26, 2023 15:22
SSH Tunneling: Map port from remote machine to your local machine so you can work from the remote DB (example using Django DB settings)...

SSH Tunneling

  1. In your local_settings.py file:

    DATABASES = {
    	'default': {
    		'ENGINE': 'django.db.backends.postgresql_psycopg2',
    		'NAME': 'django_%s' % (PROJECT_NAME,),
    

'USER': xxxx,

@mhulse
mhulse / no-x.js
Last active July 22, 2023 09:08
[no-js] [no-touch] JavaScript utilities to put in <head> of HTML templates that will add `js` or `touch` classes for use in CSS and/or JS.
<!doctype html>
<html class="no-touch no-js">
<head>
<script> /* PUT `no-x.js` here, as early as possible, before any other CSS or JS calls ... */ </script>
</head>
...
@mhulse
mhulse / DetectDrag.as
Last active March 13, 2023 11:53
AS3: Drag object and detect what’s under the mouse during move.
package {
import flash.display.*;
import flash.events.*;
public class Main extends MovieClip {
// Constructor:
public function Main() {
@mhulse
mhulse / models.py
Created June 17, 2011 17:42
Django basic/simple category/sub-category model.
# ...
class Category(Base):
slug = models.SlugField(_(u'slug'), max_length=100, unique=True)
title = models.CharField(_(u'title'), max_length=250)
parent = models.ForeignKey('self', blank=True, null=True, related_name='child')
class Meta:
verbose_name_plural = 'Categories'
<?php
/**
* Get a list of the most recently updated blogs.
*
* A copy of WP's `get_last_updated()`, exept I've added ability to filter
* and removed the need to pass so many args.
*
* @todo Move `$ignore` values to more global location?
*
@mhulse
mhulse / .bash_profile
Created November 24, 2019 05:27
Dot files stuffs, putting here as I’m trying to switch to oh-my-zsh (https://github.com/mhulse/dotfizzles)
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DOTFIZZLES="$(cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd)"
export DOTFIZZLES
@mhulse
mhulse / gist:644c80f1c273f2e7e96a475b7b6aca5b
Last active March 2, 2022 21:56
Agile story point system
1 = 1-4 hours, a day or less, low complexity
2 = 1ish days, a day or so, medium complexity
4 = several days, 1/4 of a 3-week sprint, (maybe a meeting or two)
8 = the whole sprint, (and should likely be vetted to see if it can be broken up into two 4s, etc. break it down! potential blockers, meetings)
In general, there should be 16 points total for a developer, with 8-10 points for feature work (in a 1.5 week dev portion of the sprint).