Skip to content

Instantly share code, notes, and snippets.

// settings.json
{
"tailwindCSS.includeLanguages": {
"plaintext": "html",
"haml": "html"
},
// https://github.com/tailwindlabs/tailwindcss/issues/7553#issuecomment-735915659
"tailwindCSS.experimental.classRegex": [
":\\s*?[\"'`]([^\"'`]*).*?,?",
@jaredmoody
jaredmoody / array_of_months.rb
Last active February 8, 2020 05:32
Array of Months Performance
require 'benchmark/ips'
start_date = 1.year.ago.to_date
end_date = Date.today
Benchmark.ips do |x|
x.report "map range with Date.new and strftime" do
date_range = start_date..end_date
date_months = date_range.map {|d| Date.new(d.year, d.month, 1) }.uniq
date_months.map {|d| d.strftime "%d/%m/%Y" }
@jaredmoody
jaredmoody / Connect Airpods.applescript
Last active December 9, 2021 13:11
An Applescript to connect bluetooth devices, such as Airpods. Nice when paired with an alfred trigger.
# Don't use this script, use this one instead:
# https://gist.github.com/ieatfood/814b065964492f71f728da59a47413bc
tell application "System Events"
tell process "ControlCenter"
set bt to (first menu bar item whose title is "Bluetooth") of menu bar 1
click bt
set btCheckbox to checkbox 1 of scroll area 1 of group 1 of window "Control Center" whose title contains "AirPods Pro"
set btCheckboxValue to value of btCheckbox
tell btCheckbox to click
@jaredmoody
jaredmoody / ruby_contains_any_bench.rb
Created May 3, 2017 17:23
Benchmark for determining if array contains any member of another array
require 'benchmark/ips'
require 'set'
puts "ruby version: #{RUBY_VERSION}"
CHEESES = %w(chedder stilton brie mozzarella feta haloumi).freeze
FOODS = %w(pizza feta foods bread biscuits yoghurt bacon).freeze
Benchmark.ips do |b|
b.report("&, empty?") { (FOODS & CHEESES).empty? }
@jaredmoody
jaredmoody / alias-reminders.zsh
Created December 17, 2016 00:49
ZSH alias reminders
_-accept-line () {
emulate -L zsh
local -r GREEN=$'\e[32m' RESET_COLORS=$'\e[0m'
for k in "${(@k)aliases}"; do
[[ $aliases[$k] =~ $BUFFER ]] &&
echo -nE $'\n'"${GREEN}Alias Match: $k -> $aliases[$k]${RESET_COLORS}"
done

Keybase proof

I hereby claim:

  • I am jaredmoody on github.
  • I am jaredmoody (https://keybase.io/jaredmoody) on keybase.
  • I have a public key whose fingerprint is AFC2 F76F 0466 6B8E 0CE0 A8E2 3AF5 0B68 A1FF FA99

To claim this, I am signing this object:

source 'https://rubygems.org'
source 'https://rails-assets.org' do
gem 'rails-assets-mustache'
gem 'rails-assets-trix'
end
gem 'bourbon', '~> 5.0.0.beta3'
gem 'coffee-rails', '~> 4.1.0'
gem 'devise', git: 'https://github.com/plataformatec/devise'
> bundle exec rspec
FFFFFFFFFFFF
Failures:
1) SemanticBreadcrumbsHelper semantic_breadcrumbs should return breadcrumbs
Failure/Error: controller.instance_variable_set("@breadcrumbs", [{name: 'Home', url:'/'}])
NameError:
undefined local variable or method `controller' for #<RSpec::ExampleGroups::SemanticBreadcrumbsHelper::SemanticBreadcrumbs:0x007fd749fd46e8>
# ./spec/helpers/semantic_breadcrumbs_helper_spec.rb:7:in `block (3 levels) in <top (required)>'
@jaredmoody
jaredmoody / atom-shell.sublime-build
Created May 8, 2014 04:09
Sublime Build System for Atom Shell projects
{
"cmd": ["/Developer/Applications/Atom.app/Contents/MacOS/Atom", "${project_path}"]
}
@jaredmoody
jaredmoody / gist:8626263
Created January 26, 2014 00:53
apm planner compile fail
> qmake -spec macx-g++
> make -j8
Makefile:13235: warning: overriding commands for target `moc_qwineventnotifier_p.cpp'
Makefile:2878: warning: ignoring old commands for target `moc_qwineventnotifier_p.cpp'
Makefile:29319: warning: overriding commands for target `moc_host.cpp'
Makefile:29316: warning: ignoring old commands for target `moc_host.cpp'
Makefile:29344: warning: overriding commands for target `moc_qserialport.cpp'
Makefile:2791: warning: ignoring old commands for target `moc_qserialport.cpp'
Makefile:55640: warning: overriding commands for target `main.o'
Makefile:30721: warning: ignoring old commands for target `main.o'