Exploring the differences between the use of assert / refute versus assert_equal true / assert_equal false.
This file contains hidden or 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 python | |
| import argparse | |
| import itertools | |
| import json | |
| import math | |
| import os | |
| import re | |
| import sys | |
| import urllib2 |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>A simple map</title> | |
| <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> | |
| <!-- Load Mapbox.js --> | |
| <script src='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.js'></script> | |
| <link href='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.css' rel='stylesheet' /> |
This file contains hidden or 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
| require 'dry-types' | |
| class Carrier | |
| attr_reader :name | |
| def initialize(attributes) | |
| @name = attributes.fetch(:name) | |
| end | |
| end |
This file contains hidden or 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/sh | |
| # This script only checks the total number of offenses in modified files. | |
| # If you removed old offenses, it may not warn you about new ones. | |
| # Other scripts check all modified files for offenses. | |
| # They don't ignore old offenses. | |
| NUMBER_BEFORE=`git diff --cached --diff-filter=CMRTUXB --name-only -- '*.rb' | sed 's/^\(.*\)$/HEAD:\1/' | xargs git show | rubocop -s head -f o | tail -n 2 | head -n 1 | cut -d ' ' -f 1` | |
| NUMBER_NOW=`git diff --cached --diff-filter=ACMRTUXB --name-only -- '*.rb' | xargs cat | rubocop -s now -f o | tail -n 2 | head -n 1 | cut -d ' ' -f 1` |
This file contains hidden or 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
| # config/application.rb | |
| module MyApp | |
| class Application < Rails::Application | |
| config.autoload_paths << config.root.join('lib') | |
| end | |
| end |
This file contains hidden or 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
| namespace :db do | |
| desc 'Reset and populate sample data' | |
| task populate_sample_data: [:reset, :drop_constraints, 'fixtures:load', :create_constraints] do | |
| puts 'Fixtures loaded in the database' | |
| end | |
| desc 'Remove all database constraints' | |
| task drop_constraints: [:environment, :create_constraints_script, :drop_constraints_script] do | |
| ActiveRecord::Base.connection.execute(IO.read('tmp/drop_constraints.sql')) | |
| puts 'Constraints dropped' |