See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!
Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.
But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.
require 'csv' | |
file = "#{Rails.root}/public/data.csv" | |
table = User.all;0 # ";0" stops output. Change "User" to any model. | |
CSV.open( file, 'w' ) do |writer| | |
writer << table.first.attributes.map { |a,v| a } | |
table.each do |s| | |
writer << s.attributes.map { |a,v| v } |
CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control
and E-Tag
headers, etc.), minification, etc.
NOTE: This guide has moved to https://github.com/bpierre/switch-to-vim-for-good
This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I switched myself.
My decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.
Original gist with comments: https://gist.github.com/bpierre/0a0025d348b6001394e0
package main | |
import ( | |
"unicode" | |
) | |
// ToSnake convert the given string to snake case following the Golang format: | |
// acronyms are converted to lower-case and preceded by an underscore. | |
func ToSnake(in string) string { | |
runes := []rune(in) |
#!/bin/sh | |
# | |
# This pre-commit hook looks for `fdescribe`, `fcontext`, `fit`, `fspecify` and `fexample` in the | |
# staged files and exits with an error code of 1 if there are such changes. | |
# | |
STATUS=0 | |
DESCRIBEFILES=$(git diff --staged -G"^\s*fdescribe\(" --name-only | wc -l) | |
if [ $DESCRIBEFILES -gt 0 ] |
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
#!/usr/bin/env python | |
''' | |
Uses SURF to match two images. | |
Based on the sample code from opencv: | |
samples/python2/find_obj.py | |
USAGE | |
find_obj.py <image1> <image2> |