Sometimes, you don't need a gem for it.
This is a list of useful "snippets" for Ruby that are small but provide a lot of power. Copy them, modify them, and make them your own!
This is my list of domains that I block from Google search results using the Personal Blocklist plugin for Google Chrome.
Here is the list of reasons why I block these domains:
I had a case where I wanted components to know if the current route has changed so behavior within their scope could be triggered. This was very hard to do, but this is what I came up with and it seems to work pretty well:
didInsertElement() {
Ember.run.scheduleOnce('afterRender', this, function() {
let router = this.container.lookup('router:main');
router.addObserver('currentPath', function(){
// ... do something here
});
});
class AddContentToArticles < ActiveRecord::Migration | |
def change | |
add_column :articles, :content, :text | |
end | |
end |
var module = module || ({}).__defineSetter_('exports', function(m){window = window || {}; window.ThisModule = m; return m;}) | |
(function(){ | |
module.exports = "hello world"; | |
})(module) |
<rss version="2.0" | |
xmlns:dc="http://purl.org/dc/element/1.1/" | |
xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
xmlns:wfw="http://wellformedweb.org/CommentAPI/"> | |
<channel> | |
<title>Instant Articles | 89.3 KPCC</title> | |
<link>http://www.scpr.org</link> | |
<description>Instant Articles from KPCC's reporters, bloggers and shows.</description> | |
<item> | |
<title>Yahoo's Burbank layoffs, closure consolidates its operations at Silicon Beach</title> |
var self = this; | |
var include = function(){ | |
var len = Object.keys(arguments).length; | |
var code = ''; | |
var i = 0; | |
while(i < len){ | |
var file = arguments[i]; | |
code += (fs.readFileSync(embeditorRoot + "/" + file + '.js', "utf8") + "\n"); | |
i++; | |
} |
"https://twitter.com/eh1030/status/12345/photo/1".match(/^(?<url>https?:\/\/twitter\.com\/[-a-zA-Z0-9+&@#%?=~_|!:,.;]+\/status(es){0,1}\/(?<tweetId>\d+)\/{0,1})/) | |
# => #<MatchData "https://twitter.com/eh1030/status/12345/" url:"https://twitter.com/eh1030/status/12345/" tweetId:"12345"> |
FROM ubuntu:16.04 | |
# Install dependencies | |
RUN apt-get update --yes && apt-get upgrade --yes | |
RUN apt-get install git nodejs npm \ | |
libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++ \ | |
ffmpeg \ | |
libgroove-dev zlib1g-dev libpng-dev \ | |
redis-server --yes |
brew install awscli
aws configure
and enter your access ID and access secret, a long with us-west-1
as the region. Then initialize your environment by running eval $(docker-machine env default)
and eval $(aws ecr get-login --region us-west-1)
. It may be wise to place those last two commands in your ~/.bash_profile if you are going to be interacting with Docker and Amazon ECS a lot.