Skip to content

Instantly share code, notes, and snippets.

View mgeraci's full-sized avatar

Michael P. Geraci mgeraci

View GitHub Profile
@mgeraci
mgeraci / userChrome.css
Last active December 11, 2022 19:09
Firefox Interface Customizations
/* Hide blue stripe on active tab */
.tab-line[selected="true"] {
opacity: 0 !important;
}
/* Completely hide the "title changed" notification dot on pinned tabs */
.tabbrowser-tab > .tab-stack > .tab-content[titlechanged] {
background-image: none !important;
}
@mgeraci
mgeraci / ocg_functions.py
Last active August 24, 2020 17:59
Examples for a few strategies for returning values from functions in python.
def redefine(user_input):
result = None
if user_input < 2:
result = user_input
elif user_input < 5:
result = user_input * 2
else:
result = user_input * 3

Bourbon SCSS removal with codemod

A list of codemod steps to remove Bourbon from an scss codebase. Replace the -d src/ flag with a directory of your choice. For the project I'm converting now, each command should be run with the -d src/ flag, and then with the -d globals flag to catch all locations where scss files may live.

Transition

Basic calls to transition (e.g., @include transition(opacity 200ms linear)):

codemod -m -d src/ --extensions scss '@include transition\((.+?)\);' 'transition: \1;'
@mgeraci
mgeraci / userChrome.css
Created November 7, 2018 01:26
Hide the new tab dot on firefox pinned tabs
/* instructions on where to put this file: https://www.howtogeek.com/334716/how-to-customize-firefoxs-user-interface-with-userchrome.css/ */
.tabbrowser-tab > .tab-stack > .tab-content[pinned][titlechanged]:not([visuallyselected="true"]) {
background-image: none !important;
}
@mgeraci
mgeraci / OkcApi.js
Last active October 14, 2020 20:51
A fake api client for the OkCupid web takehome
export default {
post(url, data) {
if (!url || url === '') {
return Promise.reject(new Error('OkcApi was called without a url'));
}
if (url !== 'essay' && url !== '/essay') {
return Promise.reject(new Error(`OkcApi does not support the route '${url}'`));
}
@mgeraci
mgeraci / combine.py
Last active August 29, 2015 14:10
Overlay and combine text files
#!/usr/bin/env python
# given two files, combine them line by line, character by character, such that
# the output takes a character from whichever file iesn't blank (defaulting to
# the character in file1)
import linecache
import os
path = os.path.dirname(os.path.realpath(__file__))
@mgeraci
mgeraci / gist:5e23f5bdcc47dc4bece4
Created May 13, 2014 17:28
glue.py, modified to output scss mixins
#!/usr/bin/env python
import re
import os
import sys
import copy
import time
import signal
import StringIO
import hashlib

Keybase proof

I hereby claim:

  • I am mgeraci on github.
  • I am mgeraci (https://keybase.io/mgeraci) on keybase.
  • I have a public key whose fingerprint is C7B2 3496 19DC 4F2A 73FF 147D 69E4 0628 490D DCD9

To claim this, I am signing this object:

@mgeraci
mgeraci / gist:3299637
Created August 8, 2012 23:14
better coffeescript url detection
# regex is from http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/
exp = ///
\b(?:(?:https?|ftp|file)://|www\.|ftp\.)
(?:\([-A-Z0-9+&@\#/%=~_|$?!:,.]*\)|[-A-Z0-9+&@\#/%=~_|$?!:,.])*
(?:\([-A-Z0-9+&@\#/%=~_|$?!:,.]*\)|[A-Z0-9+&@\#/%=~_|$])
///ig
for url in $(this).text().match exp
# add a protocol if it just starts with www
url_with_protocol = "http://#{url}" if url.match(/^www.+/)