When you are in a shell in Linux, you may be led to believe you are in directory
xyz
but might actually be in directorypqr
.
In a terminal,
# In Haskell, you write a function like this: | |
# f :: a -> b | |
# which reads as "f is a function from type a to b" | |
# | |
# Function composition allows you to chain functions together, | |
# building more powerful and complex composite functions from | |
# simpler component functions. | |
# | |
# OOP does not have a similar mechanism. Composition in OOP seems | |
# to mostly be limited to aggregation and delegation, neither of |
# Since a key-value store is a finite, discrete function, and functions | |
# can be composed, then Hashes can be composed. | |
# | |
# The syntactic sugar for calling lambdas, accessing array values, and | |
# other objects which have a #[] method allow composition of Hashes | |
# with all sorts of objects and contexts with the same implementation. | |
# | |
# Play with it at https://eval.in/388458 | |
# | |
class Hash |
#!/usr/bin/env ruby | |
# A program that sorts the output from the command `du -h' | |
# Use it like: du -h . | $PROGRAM_NAME [-r|--reverse] | |
SUFFIX = { | |
'K' => 1E3, | |
'M' => 1E6, | |
'G' => 1E9, | |
'T' => 1E12, |
Created after reading Learning the vi and vim editors seventh editor. O`Reilly, 2008
" ---------------------------------------------------------------------------- | |
" vimawesome.com | |
" ---------------------------------------------------------------------------- | |
function! VimAwesomeComplete() abort | |
let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$') | |
echohl WarningMsg | |
echo 'Downloading plugin list from VimAwesome' | |
echohl None | |
ruby << EOF | |
require 'json' |
copy() { | |
if [[ $1 =~ ^-?[hH] ]]; then | |
echo "Intelligently copies command results, text file, or raw text to" | |
echo "OS X clipboard" | |
echo | |
echo "Usage: copy [command or text]" | |
echo " or pipe a command: [command] | copy" | |
return | |
fi |
There once was a project that made extensive use of Pivotal's "Unbuilt Rails Dependency" pseudo-Gem architectural feature. After realising that that was far more limited in its applicable use cases than hoped, efforts were made to claw those back into namespaced classes within the main Rails app.
This was generally successful for a while. The use-case actions/service layer and one of the two core entities, User
s, worked Just Fine. When work began on the Post
entity, however, increasing forward progress was abruptly halted by a weird error.
Given the files spec/entities/post_spec.rb
and app/entities/post.rb
as below, running bundle exec rspec spec/entities/post_spec.rb
gives the following output
Coverage re
local index1, index2 | |
set index1 to 3 -- 1920 x 1200 | |
set index2 to 4 -- 1280 x 800 | |
-- Launch "System Preferences", open the "Displays" options and change to the "Display" tab | |
tell application "System Preferences" | |
activate | |
set the current pane to pane id "com.apple.preference.displays" | |
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays" |
require 'rspec/core/formatters/base_text_formatter' | |
# Custom Rspec formatter | |
# bundle exec rspec --require ./hearts_formatter.rb --format HeartsFormatter | |
# | |
class HeartsFormatter < RSpec::Core::Formatters::BaseTextFormatter | |
DOT_SUCCESS = "💚" | |
DOT_PENDING = "💛" | |
DOT_FAILURE = "💔" |