Skip to content

Instantly share code, notes, and snippets.

View anoobbava's full-sized avatar
🎯
Focusing

Anoob Bava anoobbava

🎯
Focusing
View GitHub Profile
@anoobbava
anoobbava / config.yml
Last active October 24, 2017 14:54
circle CI yml
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.4.1-node-browsers
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
@anoobbava
anoobbava / codeclimate gem file
Created November 15, 2017 16:42
travis_ci_gemfile
group :test do
gem 'simplecov'
gem 'codeclimate-test-reporter', '~> 1.0.0'
end
@anoobbava
anoobbava / spec_helper.rb
Created November 15, 2017 16:45
sample spec_helper
require 'simplecov'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
SimpleCov.start
RSpec.configure do |config|
config.include Devise::Test::ControllerHelpers, type: :controller
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
@anoobbava
anoobbava / post-merge
Created November 17, 2017 01:18 — forked from GianlucaGuarini/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@anoobbava
anoobbava / spec_helper
Created February 27, 2018 13:10
Spec_helper for Blog Application
# encoding: utf-8
require 'simplecov'
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
SimpleCov.start do
add_group 'Controllers', 'app/controllers'
add_group 'Models', 'app/models'
end

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@anoobbava
anoobbava / errors_controller.rb
Last active March 22, 2018 14:54
custom rails pages blog
# encoding: utf-8
class ErrorsController < ApplicationController
skip_before_action :authenticate_user!
def not_found
respond_to do |format|
format.html { render status: 404 }
end
end
@anoobbava
anoobbava / not_found.haml
Created March 22, 2018 15:00
custom errors blog
.container
=# image_tag('page_not_found.jpg', 'image not found')
= image_tag("404.jpg", size: "100x200", alt: "page not found")
%h1 OOPS!!!!!
%p We’re sorry but it appears that we can’t find the page you were looking for. Usually this occurs because of a page that previously existed was removed or you’ve mistyped the address.
%span.go-back
%a{:href => "/"} Go back

It looks as though using Release Phase commands (available as of 2 June 2016) is the preferred way of running things like migrations after the slug has been compiled and deployed.

The Buildpack API explicitly suggests avoiding side effects during the build:

Buildpack developers should avoid generating side effects during the build. For example, it is not recommended to perform database migrations in the compile script.

The following example creates a Rails app with a single migration and demonstrates that the migration is run after deployment.

# Create empty Rails app