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 | |
if ARGV.length != 2 | |
puts | |
puts 'ERROR! This script needs exactly two strings as input. Example: ' | |
puts | |
puts ' ruby subsequence.rb XMJYAUZ MZJAWXU' | |
puts | |
exit -1 | |
end |
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 | |
if ARGV.length != 2 | |
puts | |
puts 'ERROR! This script needs exactly two strings as input. Example: ' | |
puts | |
puts ' ruby subsequence.rb XMJYAUZ MZJAWXU' | |
puts | |
exit -1 | |
end |
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
#!/bin/sh | |
# this test case script assumes that you are on macOS and have Homebrew (brew) installed | |
set -e | |
brew install nvm | |
mkdir -p ~/.nvm | |
export NVM_DIR="$HOME/.nvm" |
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
``` | |
Fetching rmagick 2.16.0 | |
Installing rmagick 2.16.0 with native extensions | |
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. | |
current directory: /Users/s/.gem/ruby/2.5.1/gems/rmagick-2.16.0/ext/RMagick | |
/Users/s/.rubies/ruby-2.5.1/bin/ruby -r ./siteconf20180624-31720-1jgmacc.rb extconf.rb | |
checking for clang... yes | |
checking for Magick-config... yes | |
checking for outdated ImageMagick version (<= 6.4.9)... no |
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
promises = [] | |
# Create the collection of promises to do | |
(1..10).each do |i| | |
promises << Concurrent::Promise.execute do | |
thing = get the thing from the API | |
Thing.create! name: thing.name | |
end | |
end |
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
module Rack | |
class AppRedirect | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
if request.host.start_with?("app.") |
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
require 'prime' | |
output = [] | |
current_index = 0 | |
range = Prime.first(10000) | |
Prime.first(20).each do |next_prime| | |
output << range[current_index] | |
current_index += next_prime | |
end |
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 PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title></title> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<style type="text/css"> | |
td.linenos { background-color: #f0f0f0; padding-right: 10px; } | |
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } |
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
> heroku open -r staging | |
module.js:557 | |
throw err; | |
^ | |
Error: Cannot find module '@cli-engine/engine' | |
at Function.Module._resolveFilename (module.js:555:15) | |
at Function.Module._load (module.js:482:25) | |
at Module.require (module.js:604:17) |
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
find . -name \*.rb -exec perl -p -i -e 's/([^:]):(\w+)\s*=>/\1\2:/g' {} \; |