Instantly share code, notes, and snippets.

View PipeForward.swift
// pipe-forward operator
precedencegroup ForwardApplication {
associativity: left
}
infix operator |>: ForwardApplication
func |> <A, B>(a: A, f: (A) -> B) -> B {
return f(a)
}
View richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

View blue_green.sh
#!/bin/bash
echo "Building app."
mvn clean package
echo "Pushing Blue."
cf push seb -f manifest.yml
echo "Pushing Green."
cf push seb-green -f manifest.yml
View Program.cs
using System;
using System.IO;
using System.Threading;
using System.Xml;
using Couchbase;
namespace ConsoleApp1
{
class Program
{
View TestStuff.ps1
[CmdletBinding()]
Param (
[Parameter(Mandatory=$True)]
[string]$Foo,
[Parameter(Mandatory=$True)]
[string]$Bar
)
echo "Foo: $Foo"
View profile.ps1
# need to have this all the time in $USER_HOME\Documents\WindowsPowerShell\profile.ps1
Set-PSReadLineKeyHandler -Key Tab -Function Complete
Set-PSReadLineOption -EditMode Emacs
View recursive_block.rb
def foo(n, &block)
if n > 0
yield(n)
foo(n - 1, &block)
end
end
View selection.rb
def selection_sort(array, start_idx=0)
smallest_value, swap_idx = nil, nil
for idx in start_idx..(array.size - 1)
val = array[idx]
if smallest_value.nil? || smallest_value > val
smallest_value = val
swap_idx = idx
end
end
View bubble.rb
def bubble_sort(array)
@swap_needed = false
array.each_with_index do |val, idx|
a = val
b = array[idx + 1]
if !b.nil? && a > b
@swap_needed = true
array[idx] = b
array[idx + 1] = a
View git-index.sh
$ git init .
Initialized empty Git repository in /Users/swittnekamp/tmp/git_index/.git/
$ cat <<EOF > foo.txt
Some example content
EOF
$ git add foo.txt
$ git status