Make sure you have installed Homebrew and (Homebrew-Cask)[http://caskroom.io/].
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Homebrew-cask
brew install caskroom/cask/brew-cask
| <?php | |
| /** | |
| * Gets the primary term of a post, by taxonomy. | |
| * If Yoast Primary Term is used, return it, | |
| * otherwise fallback to the first term. | |
| * | |
| * @version 1.3.0 | |
| * | |
| * @link https://gist.github.com/JiveDig/5d1518f370b1605ae9c753f564b20b7f |
| <?php | |
| // Images in post galleries | |
| add_filter( 'get_post_galleries', '_img_url_filter', PHP_INT_MAX ); | |
| add_filter( 'widget_media_image_instance', '_img_url_filter', PHP_INT_MAX ); | |
| // Core image retrieval | |
| add_filter( 'image_downsize', '_img_url_filter', 10, 3 ); | |
| // Responsive image srcset substitution |
| #!/bin/bash | |
| iptables -A INPUT -i docker0 -j ACCEPT | |
| # Assumes host has `jq` installed | |
| docker network inspect bridge | jq -r .[0].IPAM.Config[0].Gateway |
| server { | |
| listen 80; | |
| server_name *.domain.tld; | |
| merge_slashes off; | |
| location / { | |
| proxy_pass http://somealternatedomain.tld; | |
| } | |
| } |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| Object.defineProperty(global, '__stack', { | |
| get: function () { | |
| var orig = Error.prepareStackTrace; | |
| Error.prepareStackTrace = function(_, stack){ return stack; }; | |
| var err = new Error; | |
| Error.captureStackTrace(err, arguments.callee); | |
| var stack = err.stack; | |
| Error.prepareStackTrace = orig; | |
| return stack; | |
| } |
Make sure you have installed Homebrew and (Homebrew-Cask)[http://caskroom.io/].
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Homebrew-cask
brew install caskroom/cask/brew-cask
Note: This will be a contrived example, but hopefully illustrates some real-world trade-offs.
Example scenario: Suppose you're an independent web developer, and a client asks you to prototype a redesign of their website header. You'll be paid for your time, and if the client likes it, you'll be hired to do the full implementation. Your incentive is to show the client a quick, functional demo of the updated header. The problem is that quick and functional tend to be mutually-exclusive.
| #!/bin/bash | |
| # http://docs.mongodb.org/ecosystem/platforms/amazon-ec2/ | |
| # the following command is the updated version of the command | |
| # used to setup the mongo instance along with the recommended | |
| # EBS volumes | |
| aws --profile <AWS_PROFILE> ec2 run-instances \ | |
| --image-id <CURRENT_AWS_LINUX_AMI> \ | |
| --instance-type <INSTANCE_TYPE> \ | |
| --security-group-ids <SECURITY_GROUP_ID> \ |
| var https = require('https'); | |
| var util = require('util'); | |
| exports.handler = function(event, context) { | |
| console.log(JSON.stringify(event, null, 2)); | |
| console.log('From SNS:', event.Records[0].Sns.Message); | |
| var postData = { | |
| "channel": "#aws-sns", | |
| "username": "AWS SNS via Lamda :: DevQa Cloud", |