Skip to content

Instantly share code, notes, and snippets.

View bdthinh's full-sized avatar
🎯
Focusing

Thinh D. Bui bdthinh

🎯
Focusing
View GitHub Profile
@bdthinh
bdthinh / how-to-start-colima-automatically-on-macos.md
Created April 21, 2023 22:57 — forked from fardjad/how-to-start-colima-automatically-on-macos.md
[How to start Colima automatically on macOS] Instructions for starting Colima automatically on macOS similar to Docker Desktop #macos #colima #docker

Steps

  1. Create an executable script to run in foreground and manage colima:
cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg
#!/bin/bash

export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
@bdthinh
bdthinh / react-lifecycle-cheatsheet.md
Created March 13, 2019 10:40 — forked from bvaughn/react-lifecycle-cheatsheet.md
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
@bdthinh
bdthinh / git-dmz-flow.md
Created November 9, 2017 10:21 — forked from djspiewak/git-dmz-flow.md
Git DMZ Flow

Git DMZ Flow

I've been asked a few times over the last few months to put together a full write-up of the Git workflow we use at RichRelevance (and at Precog before), since I have referenced it in passing quite a few times in tweets and in person. The workflow is appreciably different from GitFlow and its derivatives, and thus it brings with it a different set of tradeoffs and optimizations. To that end, it would probably be helpful to go over exactly what workflow benefits I find to be beneficial or even necessary.

  • Two developers working on independent features must never be blocked by each other
    • No code freeze! Ever! For any reason!
  • A developer must be able to base derivative work on another developer's work, without waiting for any third party
  • Two developers working on inter-dependent features (or even the same feature) must be able to do so without interference from (or interfering with) any other parties
  • Developers must be able to work on multiple features simultaneously, or at lea
@bdthinh
bdthinh / keymap.cson
Created November 17, 2016 17:32 — forked from sethlopezme/keymap.cson
My Atom keymap for focusing and splitting panes, and moving pane items. Based on the shortcuts from the Origami (https://packagecontrol.io/packages/Origami) package for Sublime Text.
'.platform-darwin':
# focus pane
'cmd-k left': 'window:focus-pane-on-left'
'cmd-k right': 'window:focus-pane-on-right'
'cmd-k up': 'window:focus-pane-above'
'cmd-k down': 'window:focus-pane-below'
# split pane
'cmd-k cmd-left': 'pane:split-left'
'cmd-k cmd-right': 'pane:split-right'
'cmd-k cmd-up': 'pane:split-up'
@bdthinh
bdthinh / introrx.md
Created September 23, 2016 04:17 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@bdthinh
bdthinh / uninstall_gems.sh
Created September 6, 2016 06:46 — forked from IanVaughan/uninstall_gems.sh
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@bdthinh
bdthinh / Sublime Text 3 Build 3103 License Key - CRACK
Created September 4, 2016 16:34
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)

Capybara

save_and_open_page

Matchers

have_button(locator)