Skip to content

Instantly share code, notes, and snippets.

@yellow5
yellow5 / phx_webpack_example_init.sh
Last active June 7, 2019 15:27
Shell commands to create + config phoenix + webpack example project.
cdykes@Camerons-MBP:~/projects/my_stuff$ asdf current
elixir 1.8.2-otp-21 (set by ASDF_ELIXIR_VERSION environment variable)
erlang 21.3.7 (set by ASDF_ERLANG_VERSION environment variable)
nodejs 10.16.0 (set by ASDF_NODEJS_VERSION environment variable)
ruby 2.6.3 (set by /Users/cdykes/.tool-versions)
cdykes@Camerons-MBP:~/projects/my_stuff$ asdf exec mix phx.new phx_webpack_example
* creating phx_webpack_example/config/config.exs
* creating phx_webpack_example/config/dev.exs
* creating phx_webpack_example/config/prod.exs
* creating phx_webpack_example/config/prod.secret.exs
@yellow5
yellow5 / refresh_vagrant_jessie64.bash
Created November 3, 2016 14:17
Script to reload a locally managed vagrant base box with a VMware Fusion provider.
#!/bin/bash
# Save the current directory.
pushd ./
# Change to the directory that contains the VM.
cd ~/Documents/Virtual\ Machines.localized/Debian\ Jessie\ 64\ -\ Base.vmwarevm/
# Defragment and shrink the virtual disk.
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d Virtual\ Disk.vmdk
@yellow5
yellow5 / 00_info.md
Last active June 10, 2016 03:09
Assets for wkhtmltopdf margin + link debugging.

The goal of these assets is to show what happens to a working link in the footer of a generated PDF based on the presence of margins.

Stack:

  • wkhtmltopdf v0.12.3
  • debian jessie 64-bit
  • page.html + page_footer.html assets

The execution examples should provide two results for comparison. The result generated without margins contains a link in the footer that works as expected. The result generated with the margins exposes the issue described in this issue (1), the link element roughly 0.5" above the linked text.

@yellow5
yellow5 / 01_jsonapi_trailblazer.sh
Created June 8, 2016 14:33
This gist showcases various stages of the devotional API endpoint in JSON-API format.
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service(wip/spike-trailblazer)$ git checkout 890cc936f3f7ad709947b71098f6191b1ced4a8f
.......
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service((detached from 890cc93))$ http localhost:3000/api/v1/devotionals/12
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: Keep-Alive
Content-Length: 624
Content-Type: application/json; charset=utf-8
Date: Wed, 08 Jun 2016 14:26:19 GMT
Etag: W/"e1bd33b95c3b6ff9dcf292916a8c1914"

The guide is very informative and left me with very few questions!

Highlights:

  • Excellent job showing what happens with cargo build execution.
  • Same for cargo run and inclusion of the --release flag.
  • Good descriptions of the purpose and concerns of the Cargo.toml and Cargo.lock files.
  • Noted when to include Cargo.lock in the repo: yes for apps, no for libs (similar to Gemfile.lock in Ruby apps/gems).

Maybe helpfuls:

@yellow5
yellow5 / search.sh
Created June 11, 2013 17:27
aptitude emoji search
cameron@cam-gazelle:~$ aptitude search emoji
p fcitx-table-emoji - Flexible Input Method Framework - Emoji table
p ibus-table-emoji - ibus-table input method: Emoji
p librime-data-emoji - RIME schema data - Emoji
@yellow5
yellow5 / tables_with_foreign_keys.sql
Created February 14, 2013 20:28
Query to list all foreign keys for a given schema in MySQL.
SELECT table_name, constraint_name
FROM information_schema.table_constraints
WHERE
table_schema = 'DATABASE_NAME' AND
constraint_type= 'FOREIGN KEY'
;
@yellow5
yellow5 / hidden_flags.txt
Created September 18, 2012 04:13
gitflow command flags not displayed via help command
git flow feature finish -DS
-D = force delete feature branch after finish
-S = sqash feature during merge
git flow feature pull -r
-r = pull with rebase
git flow release finish -fns
-f = use the contents of the given file as a tag message
-n = don't tag this release
@yellow5
yellow5 / model_record_updates.rake
Created May 12, 2012 03:12
Convert old MySQL datetime values from system time zone to UTC (helpful for rails 2.3 apps upgrading to rails 3.x)
namespace :model_record_updates do
desc 'Convert all datetimes to UTC values'
task :convert_datetime_to_utc => :environment do
puts "Environment: #{Rails.env}\n\n\n"
#
# This should be run only once, since it will adjust the database values every time it is run!
#
adjust_by = '+05:00' # How much to alter datetime value by. This is case-by-case, and mine was CST!
@yellow5
yellow5 / build_with_19_flag.sh
Created March 13, 2012 03:41
RVM + JRuby + doc generation
cameron@cam-gazelle:~$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b24~pre2-1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
cameron@cam-gazelle:~$ rvm get head
Downloading RVM from wayneeseguin branch master
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 125 100 125 0 0 464 0 --:--:-- --:--:-- --:--:-- 702
100 921k 100 921k 0 0 549k 0 0:00:01 0:00:01 --:--:-- 1161k