Skip to content

Instantly share code, notes, and snippets.

@yellow5
yellow5 / git-flow.sh
Created October 19, 2011 20:59
git flow examples
# creating a new feature
git flow feature start awesome-new-feature
# pushing to origin for other eyes
git flow feature publish awesome-new-feature
# tracking an existing remote feature branch
git flow feature track another-new-feature
# finishing a feature
@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 / importer.rb
Created March 4, 2012 04:25
Ruby spec stubbing a block using mocha
class Importer
def parse_csv_file(csv_file)
File.open(csv_file) do |file|
ActiveRecordModel.transaction do
import_csv_stream(file)
end
end
end
end
@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