Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
class User < ActiveRecord::Base | |
# ... lots of persistence stuff | |
end | |
class GitHubUserProvisioner < SimpleDelegator | |
def provision_with!(user_info, extra_user_hash) | |
self.github_login = extra_user_hash['login'] | |
self.name = user_info['name'] | |
self.email = user_info['email'] | |
self.github_url = user_info['urls']['GitHub'] |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# alias to edit commit messages without using rebase interactive | |
# example: git reword commithash message | |
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f" | |
# sort list of git repos with gh cli | |
gh repo list --limit 300 --json name -q '.[].name' | sort | |
# count total commits in a repo | |
git rev-list --all --count |
belongs_to
association does not automatically save the object. It does not save the associated object either.has_one
association, that object is automatically saved (in order to update its foreign key).has_one
association) is unsaved (that is, new_record?
returns true) then the child objects are not saved. They will automatically when the parent object is saved.import re | |
history_snippet = '''Start-Date: 2014-08-25 12:52:37 | |
Commandline: apt-get install -y openjdk-6-jdk openjdk-7-jdk icedtea-7-plugin | |
Install: openjdk-6-jre-lib:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), icedtea-netx-common:amd64 (1.5-1ubuntu1, automatic), openjdk-6-jdk:amd64 (6b32-1.13.4-4ubuntu0.14.04.1), libxcb1-dev:amd64 (1.10-2ubuntu1, automatic), ttf-dejavu-extra:amd64 (2.34-1ubuntu1, automatic), icedtea-6-jre-cacao:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), icedtea-7-plugin:amd64 (1.5-1ubuntu1), libxau-dev:amd64 (1.0.8-1, automatic), openjdk-6-jre-headless:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), x11proto-core-dev:amd64 (7.0.24-1, automatic), libxt-dev:amd64 (1.1.4-1, automatic), openjdk-7-jdk:amd64 (7u65-2.5.1-4ubuntu1~0.14.04.1), libx11-dev:amd64 (1.6.2-1ubuntu2, automatic), x11proto-kb-dev:amd64 (1.0.6-2, automatic), openjdk-6-jre:amd64 (6b32-1.13.4-4ubuntu0.14.04.1, automatic), xtrans-dev:amd64 (1.3.2-1, automatic), libxdmcp-dev:amd64 (1.1.1-1, automatic), icedtea-netx:a |
To remove a submodule you need to:
def stuff | |
yield action: 'Boom', schedule: '7PM', color: :red, debug: true | |
end | |
# When a hash is yielded to a block, we can used named arguments to | |
# capture the keys we want, and an anonymous splat to ignore | |
# everything else | |
stuff { |action:, schedule:, **| p "Doing #{action} at #{schedule}" } | |
# |
# Flags Ruby | |
# Sentinel to check that the rbenv-vars plugin is in use. | |
RBENV_VARS_ENABLED=1 | |
# Ruby 2.1 GC reading: | |
# http://tmm1.net/ruby21-rgengc/ | |
# http://thorstenball.com/blog/2014/03/12/watching-understanding-ruby-2.1-garbage-collector/ | |
# http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc |
# prune branches deleted in origin
git remote prune origin
# prune tags
# http://stackoverflow.com/questions/1841341/remove-local-tags-that-are-no-longer-on-the-remote-repository
git fetch --prune <remote> '+refs/tags/*:refs/tags/*'
version: '2' | |
services: | |
elasticsearch: | |
build: | |
context: elasticsearch/ | |
volumes: | |
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro | |
ports: |