Skip to content

Instantly share code, notes, and snippets.

Avatar
🏆
Platinum Status Level

Dr Nic Williams drnic

🏆
Platinum Status Level
  • Brisbane, Australia
  • Twitter @drnic
View GitHub Profile
@drnic
drnic / slim-select.css
Last active Aug 15, 2022
Rewrite of https://github.com/brianvoe/slim-select stylesheet using tailwindcss. Some color/size changes for my specific project; but you can find them easily now.
View slim-select.css
.ss-main {
@apply relative inline-block select-none w-full text-slate-500;
}
.ss-main .ss-single-selected {
@apply flex cursor-pointer w-full min-h-[38px] p-[6px];
@apply bg-white border border-gray-200 shadow-sm rounded outline-0;
@apply transition-colors duration-200;
}
.ss-main .ss-single-selected.ss-disabled {
@apply bg-slate-300 cursor-not-allowed;
View commits-since-last-production-deploy.sh
#!/bin/bash
help() {
echo "Usage: ./bin/commits-since-last-production-deploy [-a myapp ] [ -h ]"
exit 2
}
if ! command -v heroku &>/dev/null; then
echo "Install 'heroku' CLI"
exit 1
View docker-compose.yml
version: "3.2"
services:
dev:
image: tianon/true
restart: "no"
depends_on:
- db
- redis
db:
@drnic
drnic / schema_dumper.rb
Last active Feb 10, 2022
Our rails db includes our own tables/schema and the Salesforce/Heroku Connect schema (under "salesforce.*"). We place this file in config/initializers/schema_dumper.rb and now our rails db:schema:dump includes both our own tables and the salesforce. tables.
View schema_dumper.rb
# This solution was based on https://gist.github.com/GlenCrawford/16163abab7852c1bd550547f29971c18
Rails.configuration.to_prepare do
ActiveRecord::SchemaDumper.ignore_tables = %w[
salesforce._hcmeta
salesforce._sf_event_log
salesforce._trigger_log
salesforce._trigger_log_archive
]
end
View application_reflex.rb
class ApplicationReflex < StimulusReflex::Reflex
before_reflex do
jwt = ShopifyApp::JWT.new(element.data_jwt) # pass in "Bearer: blah"
if jwt
self.headers = {"jwt.shopify_domain" => jwt.shopify_domain, "jwt.shopify_user_id" => jwt.shopify_user_id}
end
end
end
View Procfile
web: ./bin/rackup -p "$PORT"
View Gemfile
gem "google-id-token"
@drnic
drnic / AlignmentWidget.vue
Last active Jul 6, 2020
Vue component for some alignment buttons. Demo at https://share.getcloudapp.com/2Nu5bL1B
View AlignmentWidget.vue
<template>
<span class="p-1 inline-flex items-center rounded-lg bg-gray-200">
<button
@click="alignmentSelected = 'left'"
:class="alignmentSelected == 'left' ? 'bg-white shadow' : 'hover:bg-gray-400'"
class="p-1 rounded-lg"
>
<svg class="h-6 w-6 text-gray-200" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 333 333">
<path
stroke="currentColor"
View aaa.md
git clone https://gist.github.com/drnic/a042bd719ed9213c5af7fd1605f8bf93 ~/workspace/pipeline.bk-run-docker-fail
cd ~/workspace/pipeline.bk-run-docker-fail

bk run pipeline.bk-run-docker-fail.yml -E AGENT_ENV=where-is-this-env

The output should include the two lines:

@drnic
drnic / Procfile
Last active Feb 9, 2020
Deploy https://jupyter.org/ Jupyter Lab to Cloud Foundry
View Procfile
web: jupyter lab --ip 0.0.0.0 --port $PORT --no-browser