module Lisp
def cons(x,y)
-> (m) { m.call(x,y) }
end
def car(z)
z.call(-> (p, q) { p })
end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Distribution.Simple | |
import Distribution.PackageDescription | |
import Distribution.PackageDescription.Parse (readPackageDescription) | |
import Distribution.Verbosity (silent) | |
version <- fmap (showVersion . pkgVersion . package . packageDescription) | |
$ readPackageDescription silent "stackbuilders.com.cabal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe AdRank do | |
describe 'Factories' do | |
it 'has a couple of factories that return valid instances' do | |
build(:ad_rank).should be_valid | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def snail(array) | |
array.empty? ? [] : array.shift + snail(array.transpose.reverse) | |
end |
Let's say you have a books
table and corresponding model with a title
and author
column...
Your challenge: come up with a way to present the title and author together for every book in your library. In other words, normalize the author
and title
data for each book.
How can we achieve this for consistent formatting for our library, without:
- using any
ActiveRecord
callbacks; - overwriting the setter methods
ActiveRecor
d dynamically dispatches by inspecting theschema
file; or - making things look messy & gross (i.e one-liner if possible!)
- 100% XML-based protocol
- 100%
- 100% good smelling!
Attribute type
modifier for both address
blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⇒ tree . | |
. | |
├── ChangeLog | |
├── INSTALL_RECEIPT.json | |
├── LICENCE | |
├── NEWS | |
├── README | |
├── bin | |
│ ├── zsh | |
│ └── zsh-5.0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef git git-cvsserver git-receive-pack git-upload-archive git-upload-pack git-shell gitk tig | |
# Some parts of this completion's behaviour are configurable: | |
# | |
# Say you got your own git sub-commands (git will run a program `git-foo' | |
# when you run "git foo") and you want "git f<tab>" to complete that sub | |
# commands name for you. You can make that sub-command know to the completion | |
# via the user-command style: | |
# | |
# % zstyle ':completion:*:*:git:*' user-commands foo:'description for foo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef git gitk | |
# zsh completion wrapper for git | |
# | |
# Copyright (c) 2012-2013 Felipe Contreras <felipe.contreras@gmail.com> | |
# | |
# You need git's bash completion script installed somewhere, by default it | |
# would be the location bash-completion uses. | |
# | |
# If your script is somewhere else, you can configure it on your ~/.zshrc: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find all files/directories from current directory recursively down into all folders | |
# USE: ff filename (ex: "ff '*spec.rb'" or "ff *spec.rb"). If can't find file, | |
# "cd .." into directory above current one, then try this again. | |
function ff { | |
find . -name $1 | |
} | |
# Like ff. Finds only files. Excludes directories. | |
# USE: f filename | |
function f { |
OlderNewer