PRs are a great way of sharing information, and can help us be aware of the changes that are occuring in our codebase. They are also an excellent way of getting peer review on the work that we do, without the cost of working in direct pairs.
Ultimately though, the primary reason we use PRs is to encourage quality in the commits that are made to our code repositories
Done well, the commits (and their attached messages) contained within tell a story to people examining the code at a later date. If we are not careful to ensure the quality of these commits, we silently lose this ability.
(use-package move-text | |
:bind (([(meta up)] . move-text-up) | |
([(meta down)] . move-text-down))) | |
(use-package spaceline | |
:ensure t | |
:init | |
(require 'spaceline-config) | |
(let ((faces '(mode-line | |
mode-line-buffer-id |
#!/usr/bin/env python | |
# coding=utf8 | |
import random | |
import math | |
def partial_difference_quotient(f, v, i, h): | |
"""This function approximates the derivate function as h approaches zero""" | |
dv = [elem + (h if index == i else 0) |
import flask | |
import uuid | |
import httplib2 | |
from oauth2client.client import flow_from_clientsecrets | |
from oauth2client.client import OAuth2Credentials, AccessTokenRefreshError | |
from apiclient.discovery import build | |
app = flask.Flask(__name__) | |
app.secret_key = str(uuid.uuid4()) |
;; | |
;; A simple banking system as an example to illustrate refs in Clojure | |
;; | |
(def account-a (ref 100)) | |
(def account-b (ref 100)) | |
(defn transfer! [amount from to] | |
(dosync | |
(if (>= (- @from amount) 0) |
#!/bin/bash | |
for post in $(find . -name *.md) | |
do | |
date=$(grep -i "date: " $post | sed -e "s/[dD]ate: \([0-9-]\+\).*/\1/g") | |
clean_date=$(echo $date | awk -F " " '{print $2}') | |
if [[ ! -z $clean_date ]] | |
then | |
cp $post /path-to-blog/_posts/$clean_date-$(basename $post) | |
fi |
;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix | |
;; and optionally can refer functions to the current ns. | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; | |
;; * :refer-clojure affects availability of built-in (clojure.core) | |
;; functions. |
(defn neighbours | |
([size node] (neighbours [[-1 0] [0 -1] [1 0] [0 1]] size node)) | |
([deltas size node] | |
(vec (filter (fn [n] | |
(every? #(< -1 % size) n)) | |
(map #(vec (map + node %)) deltas))))) | |
;; h(x) | |
(defn heuristic-estimate [step-cost size y x] | |
(- (+ size size) y x 2)) |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.