- Add to your Gemfile and
bundle install --binstubs
(then runrails app:update:bin
to fix bundler overwriting Rails 5 default bin stub).
group :development do
gem 'ruby-debug-ide'
gem 'debase'
# If you want some nice documentation,
objects = [MyObject.new(name: "John Smith"), MyObject.new(name: "Joan Smith"), MyObject.new(name: "Jane Doe")] | |
objects.select {|o| o.name["Smith"]}.each do |o| | |
o.name.gsub!("Smith", "Jones") | |
o.save | |
end |
$ curl env-printer.55726d54-72cd-4564-9c52-e46845c20433.k8s.civo.com ⎈ |prod:default | |
GET / HTTP/1.1 | |
Host: env-printer.55726d54-72cd-4564-9c52-e46845c20433.k8s.civo.com | |
User-Agent: curl/7.64.1 | |
Accept: */* | |
X-Forwarded-For: 192.168.0.8 | |
X-Forwarded-Host: env-printer.55726d54-72cd-4564-9c52-e46845c20433.k8s.civo.com | |
X-Forwarded-Port: 80 | |
X-Forwarded-Proto: http | |
X-Forwarded-Server: traefik-65bccdc4bd-tkbmn |
{"lastUpload":"2020-11-20T19:09:03.523Z","extensionVersion":"v3.4.3"} |
This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.
Most the credit for these changes go to Dave Holland.
# Add to the given file the given lines, after the line with the given text, or replace the content | |
def add_to_file(path, text, after=nil, replace=false) | |
lines = [] | |
if replace | |
lines = text | |
else | |
File.readlines(path).each do |line| | |
if after != nil and line.include?(after) | |
lines << line | |
lines << text |
--database=mysql | |
--skip-coffee | |
--skip-turbolinks | |
--template=~/.rails-template.rb |
#!/usr/bin/ruby | |
def count_lines(filename, type) | |
lines = File.read(filename).force_encoding('BINARY').split("\n") | |
lines.delete_if {|line| line[/^\s*$/]} | |
case type | |
when :ruby | |
lines.delete_if {|line| line[/^\s*#/]} | |
when :go | |
lines.delete_if {|line| line[/^\s*\/\/$/]} |
require "faraday" | |
class Customer < ActiveRestClient::Base | |
base_url "http://requestb.in" | |
ActiveRestClient::Base.faraday_config do |faraday| | |
faraday.adapter(:net_http) | |
faraday.options.timeout = 20 | |
faraday.headers['User-Agent'] = "ActiveRestClient/#{ActiveRestClient::VERSION}" | |
end | |
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.1.1' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.3' | |
# Use Uglifier as compressor for JavaScript assets |