Skip to content

Instantly share code, notes, and snippets.

Avatar

Donn Felker donnfelker

View GitHub Profile
@donnfelker
donnfelker / .zshrc
Last active Jun 29, 2022
Vanilla ZSH
View .zshrc
# Hat tip to Kaushik Gopal for some of this
# make zsh tab completion fix capitalization errors for directories and files
# i don't know if this is required anymore
# autoload -Uz compinit && compinit
# 0 -- vanilla completion (abc => abc)
# 1 -- smart case completion (abc => Abc)
# 2 -- word flex completion (abc => A-big-Car)
# 3 -- full flex completion (abc => ABraCadabra)
View config.fish
set -g theme_nerd_fonts yes
set -g theme_display_git_stashed_verbose yes
set -g theme_display_git_master_branch yes
set -g theme_display_git_untracked yes
set -g theme_display_git_dirty yes
set -g theme_display_virtualenv yes
set -Ux EDITOR code --wait
rvm default
@donnfelker
donnfelker / edit.html.erb
Created Feb 19, 2022
Stimulus JS Controller to Disable File Attachments in the Trix Editor
View edit.html.erb
<!-- File uploads will be disabled for any trix editor in this div -->
<div data-controller="registrations">
<!-- Other html elements ... -->
<div class="form-group">
<%= form.label :bio, "Bio" %>
<!-- File uploads, and the attachment button will be disabled in this rich text (trix) editor -->
<%= form.rich_text_area :bio %>
</div>
View .gitconfig
[user]
name = Your Name
email = you@youremail.com
[alias]
A = add -A
a = add
aa = add --all
ae = add --edit
ai = add --interactive
amend = commit --amend -C HEAD
View keybase.md

Keybase proof

I hereby claim:

  • I am donnfelker on github.
  • I am donnfelker (https://keybase.io/donnfelker) on keybase.
  • I have a public key ASDm0EqsT8YBPE8L0BlrQxAppoKpbs_C1r-ZER8m2blYmAo

To claim this, I am signing this object:

@donnfelker
donnfelker / macbook-lock-screen.sh
Created Jul 15, 2018
Mac Lock Screen Window Text
View macbook-lock-screen.sh
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "If found, contact YOUR-NAME at XXX-XXX-XXXX"
@donnfelker
donnfelker / prettify.css
Last active Jun 5, 2018
articles.caster.io - code theme
View prettify.css
/*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */
.prettyprint {
background: #f5f5f5;
font-family: Menlo, "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Monaco, Consolas, monospace;
border: 0 !important;
padding: 16px;
}
.pln {
color: #4d4d4c;
@donnfelker
donnfelker / RobolectricActivityTest.java
Created Nov 11, 2017
Integrating Robolectric 3 with Android Studio 2
View RobolectricActivityTest.java
package com.greenlifesoftware.robolectricpractice;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.assertNotNull;
@donnfelker
donnfelker / CustomBindingAdapters.kt
Last active Oct 20, 2017
MVVM - Removing Logic from Your Views with BindingAdapters
View CustomBindingAdapters.kt
@BindingAdapter(“isVisible”)
fun setIsVisible(view: View, isVisible: Boolean) {
if (isVislble) {
view.visibility = View.VISIBLE
} else {
view.visibility = View.GONE
}
}
@donnfelker
donnfelker / encoding-video.md
Created Jul 13, 2017 — forked from Vestride/encoding-video.md
Encoding video for the web
View encoding-video.md

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc --with-opus