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
# Custom rspec matcher for testing CanCan abilities. | |
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities | |
# | |
# Usage: | |
# should have_abilities(:create, Post.new) | |
# should have_abilities([:read, :update], post) | |
# should have_abilities({manage: false, destroy: true}, post) | |
# should have_abilities({create: false}, Post.new) | |
# should not_have_abilities(:update, post) | |
# should not_have_abilities([:update, :destroy], post) |
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
#!/bin/bash | |
# Have to redirect stderr to stdout here because slave.py uses stderr for output. | |
~/bin/slave.py list 2>&1 >/dev/null | grep beaker-slave- | while read slave; do | |
echo | |
echo "Checking status of $slave..." | |
# First, check if we can SSH into the host. If we can, then check the process and maybe shut down. | |
# This makes sure that we don't consider an SSH failure to be reason to shut down the node. | |
if ssh $slave echo < /dev/null; then |
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
# Base image. | |
FROM fotinakis/baseimage-ruby:2.1.3 | |
# System dependencies for gems. | |
RUN apt-get update | |
RUN apt-get install -y --no-install-recommends libmysqlclient-dev | |
# Add 'web' user which will run the application. | |
RUN adduser web --home /home/web --shell /bin/bash --disabled-password --gecos "" |
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 Ember from 'ember'; | |
/** | |
Targets a component's actions to bubble immediately to the application controller and | |
through the route hierarchy, skipping any parent component action handlers. | |
This allows us to avoid passing redundant args like: | |
<my-component myAction={{action "myAction"}} myOtherAction={{action "myOtherAction"}}> | |
...through many layers of nested components, at the cost of highly-coupling the actions |
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
function textNodesUnder(el){ | |
var n, a = []; | |
var walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false); | |
while (n = walk.nextNode()) { a.push(n); } | |
return a; | |
} | |
// Normalize all text nodes (merge adjacent nodes). | |
var elements = document.getElementsByTagName('*'); | |
for (var i = 0; i < elements.length; i++) { |
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
[ | |
{ "keys": ["alt+."], "command": "reveal_in_side_bar" } | |
] |
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
CREATE USER 'some_user'@'%' IDENTIFIED BY '<autogenerated password here>'; | |
GRANT ALL PRIVILEGES ON dbname.* TO 'some_user'@'%' REQUIRE SSL; |
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
RSpec.configure do |config| | |
# Freeze time and truncate microseconds in all examples. | |
config.around(:each) do |example| | |
# Truncate microseconds to avoid test flakiness when the DB truncates microseconds | |
now_without_microseconds = Time.now.in_time_zone.change(usec: 0) | |
travel_to(now_without_microseconds) do | |
example.run | |
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
#!/usr/bin/env ruby | |
# | |
# Usage: | |
# chmod +x percy-uploader.rb | |
# PERCY_TOKEN=<PERCY-REPO-WRITE-TOKEN> ./percy-uploader.rb | |
require 'percy' | |
require 'find' | |
require 'digest' |
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
// From @nickretallack - http://nickretallack.com/experiments/mdl/collapse/index.html | |
.mdl-accordion.mdl-accordion--opened | |
border-top: 1px solid #e0e0e0 | |
border-bottom: 1px solid #e0e0e0 | |
margin-top: -1px | |
.mdl-accordion.mdl-accordion--opened + .mdl-accordion.mdl-accordion--opened | |
border-top: none | |
margin-top: 0 |
OlderNewer