Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
# Sorts an array based on a property of each object within the array | |
# | |
# Examples: | |
# | |
# [Em.Object.create(a: 1), Em.Object.create(a: 5), Em.Object.create(a: 3)].sortProperty('a') | |
# > [{a: 1}, {a: 3}, {a: 5}] | |
# | |
# As a computed property: | |
# | |
# AC = Em.ArrayController.extend |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
# Only for Mac OS X, where .bashrc is otherwise ignored | |
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi | |
# MacPorts | |
export PATH=/opt/local/bin:/opt/local/sbin:$PATH | |
export MANPATH=/opt/local/share/man:$MANPATH |
Install Python
$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7
Symlinks...
# .irbrc to log goodies like SQL/Mongo queries to $stdout if in Rails 3 console | |
if defined?(Rails) && Rails.respond_to?(:logger) | |
require 'logger' | |
Rails.logger = Logger.new($stdout) | |
if defined?(Mongoid) | |
Mongoid.logger = Rails.logger | |
end | |
end |
.pagination a, .pagination span.current, .pagination span.gap { | |
float: left; | |
padding: 0 14px; | |
line-height: 38px; | |
text-decoration: none; | |
background-color: white; | |
border: 1px solid #DDD; | |
border-left-width: 0; | |
} |
class AttachedValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
record.errors.add(attribute, :attached, options) unless value.attached? | |
end | |
end |
#!/bin/bash | |
GREEN='\x1B[32m' | |
RED='\x1B[31m' | |
NOCOL='\x1B[39m' | |
echo "${GREEN}Removing exited containers${NOCOL}" | |
docker rm -v $(docker ps --filter status=dead --filter status=exited -aq) | |
echo "${GREEN}Removing dangling images${NOCOL}" | |
docker rmi $(docker images -f "dangling=true" -q) |
#!/usr/bin/env bash | |
# Example: | |
# ./find-ecr-image.sh foo/bar mytag | |
if [[ $# -lt 2 ]]; then | |
echo "Usage: $( basename $0 ) <repository-name> <image-tag>" | |
exit 1 | |
fi | |
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )" |