Skip to content

Instantly share code, notes, and snippets.

Avatar
🔐
[redacted]

Matt Todd mtodd

🔐
[redacted]
View GitHub Profile
@mtodd
mtodd / sample.geojson
Created Jul 26, 2017 — forked from landonreed/sample.geojson
Playing around with http://geojson.io #osm github etc.
View sample.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Bug.md

[ ] a [ ] b

  • c
  • d

If user is careless, forgetting to put "- " before "[ ]", TODO list could get buggy.

Steps to reproduce bug:

  • on parsed MD page of list above, tick "c" to note that "c" is done.
  • Now, edit the file.
View Broken.md
  • First option
  • Parent option
  • Nested option
  • Last option
View code_review_checklists.md

Based on the article: Using checklists for code review

In general, people are pretty good at the code review process, but it's sometimes surprising what can slip through. A natural consequence of the way our brains look at the world is that it's easy to pay a lot of attention to small details and code style flubs, and completely miss the big picture.

Obviously, not everything is applicable for every change. If the review request isn't making any changes to UI, then skip the first two checklists entirely. If a change is a bug fix, typically don't review it for architecture and design principles.

Put the big stuff first (e.g. architecture). You don't want to work through a ton of small issues before realizing that everything has to be rewritten.

> Do a pass through the code for each and every item in the checklist. By only looking for a very specific type of defect, each pass goes relatively quickly, even for large changes. Focu

View .irbrc
require 'rubygems'
require 'pp'
unless self.class.const_defined? "IRB_RC_HAS_LOADED"
# Log to STDOUT if in Rails
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
View Newtabs in current directory
on run argv
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down -- open a new tab
tell application "Terminal" to do script "cd " & item 1 of argv in front window -- change directory
end run
-- in your profile
-- alias newtab='osascript ~/.applescripts/newtab.applescript `pwd`'
View gist:180398
Surround a heredoc with quotes and you can continue the code on the same line:
render :status => 404, :text => <<-'EOH' and return unless setup
article not found<br/>
I, as a server, have failed<br/>
https?
EOH
Quotes also give you more freedom/creativity with the terminal ID:
View after-use
#!/usr/bin/osascript
on run_command(command)
tell application "Terminal"
do script "clear" in selected tab of front window
do script command in selected tab of front window
end tell
end run_command
tell application "System Events"
my run_command("cd ~/Projects/nudge")
View gist:104783
class ActionController::Request # ActionController::AbstractRequest in Rails < 2.3
# Returns true if the request seems to come from a bot
def bot?
user_agent =~ /\b(Baidu|Gigabot|Googlebot|libwww-perl|lwp-trivial|msnbot|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg)\b/i
end
end
#
# Then in your controllers you can do :
#