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 | |
#### git-browse | |
### Open a github repository in the default browser | |
### Author: @sudojosh | |
### Usage: Run `git browse` inside a repo with at least one github remote | |
### Installation: Download, run `chmod +x git-browse`, and then copy somewhere on your path | |
### for example, /usr/local/bin/ | |
remotes = `git remote -v` |
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
# spec/mailers/previews/devise_mailer_preview.rb | |
class DeviseMailerPreview < ActionMailer::Preview | |
# We do not have confirmable enabled, but if we did, this is | |
# how we could generate a preview: | |
# def confirmation_instructions | |
# Devise::Mailer.confirmation_instructions(User.first, "faketoken") | |
# end | |
def reset_password_instructions |
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
" add jbuilder syntax highlighting | |
au BufNewFile,BufRead *.json.jbuilder set ft=ruby |
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 | |
# You can skip this bit if you wish - you will need the 'ruby-trello' gem installed, and | |
# optionally, 'foreman' to run the script with. | |
require 'bundler/setup' | |
Bundler.require | |
require 'trello' | |
require 'csv' |
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
/** | |
* This AJAX prefilter is based on http://stackoverflow.com/a/12840617 with some changes: | |
* 1. References to the question asker's context have been removed (they related to Auth) | |
* 2. Fixes have been made to code style at JSHint's request. | |
* 3. Assign max retries so that we can determine how many retries we STARTED from. | |
* 4. Add a setTimeout call so that the retried requests wait before performing the request. | |
* 5. Treat a '0' status as an error. (JM: I believe this is because Ember fakes it's own 'XHR' object | |
* that doesn't contain the actual request status code). | |
*/ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Lighthouse requestig malformed URLs</title> | |
</head> | |
<body> | |
<img width="200" height="420" src="https://lorempixel.com/420/320/abstract/1/Sample?query-param-to-get-over-75-chars" /> |
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
# When Rails loads fixtures, it does so via a big multi-insert. If there is something wrong with a | |
# fixture, it's extremely difficult to find out _which_ fixture is wrong. | |
# This can be run in a binding.pry OR in a Rails console. | |
require "active_record/fixtures" | |
all = fixture_set_names = Dir["spec/fixtures/**/*.yml"].map { |f| File.basename f, '.yml' } | |
all.each do |fix| | |
puts fix; ActiveRecord::FixtureSet.create_fixtures("#{Rails.root}/spec/fixtures", [fix]) |
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
#region Calculations | |
/** <summary>A method to calculate Body-Mass Index (BMI) from a given weight and height</summary> | |
* <param name="weight">The person's weight in kilograms</param> | |
* <param name="height">The person's height in kilograms</param> | |
*/ | |
public decimal CalculateBMI(decimal weight, decimal height) { | |
bmi = Math.pow(weight / height, 2) | |
return Math.round(bmi, 2) |
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
# lib/carrierwave_ext/sanitized_file.rb | |
require "carrierwave/sanitized_file" | |
module CarrierWave | |
class SanitizedFile | |
## | |
# Returns the content type of the file. | |
# | |
# === Returns | |
# |
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
# config/email.yml | |
--- | |
test: | |
:delivery_method: :test | |
:url_host: 'localhost:3000' | |
development: | |
:delivery_method: :smtp | |
:host: "localhost:1025" | |
production: | |
:delivery_method: :smtp |
NewerOlder