Skip to content

Instantly share code, notes, and snippets.

@fotinakis
fotinakis / Dockerfile
Created November 23, 2014 20:48
Docker + fig with mounted volume for dev environment (and correctly handles bundle install).
# 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 ""
@fotinakis
fotinakis / target-application-actions.js
Last active August 29, 2015 14:14
Mixin to make nested Ember components skip bubbling actions to parent components (slightly hacky)
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
@fotinakis
fotinakis / gist:9c52c0b1180ca71faaaf
Created April 17, 2015 21:04
Sublime reveal_in_side_bar key binding
[
{ "keys": ["alt+."], "command": "reveal_in_side_bar" }
]
@fotinakis
fotinakis / do.sql
Created May 6, 2015 01:28
SQL: create a new user, grant all privileges, and require SSL
CREATE USER 'some_user'@'%' IDENTIFIED BY '<autogenerated password here>';
GRANT ALL PRIVILEGES ON dbname.* TO 'some_user'@'%' REQUIRE SSL;
@fotinakis
fotinakis / spec_helper.rb
Last active August 29, 2015 14:20
Pure-Rails timefreeze and flaky-ness removal for all specs
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
@fotinakis
fotinakis / percy-uploader.rb
Last active August 29, 2015 14:21
Upload a static website folder to Percy
#!/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'
@fotinakis
fotinakis / feature_spec_with_animation.rb
Created September 23, 2015 15:53
Percy wait_for_animation for JavaScript animations
RSpec.feature :homepage, js: true do
def finished_all_animations?
page.evaluate_script('$(":animated").length') == 0
end
def wait_for_animation
Timeout.timeout(Capybara.default_wait_time) do
sleep 0.1 until finished_all_animations?
end
end
@fotinakis
fotinakis / disable-jquery-animations.js
Created March 30, 2016 21:15
Turn off jQuery animations
$.fx.off = true;
@fotinakis
fotinakis / freeze-css-animations.css
Last active April 1, 2016 00:25
Stop transitions and animations
*, *::before, *::after {
-moz-transition: none !important;
transition: none !important;
-moz-animation: none !important;
animation: none !important;
}
@fotinakis
fotinakis / .gitignore_global
Last active April 5, 2016 23:40
Git config
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db