Skip to content

Instantly share code, notes, and snippets.

View ParkinT's full-sized avatar
💭
Retired from the workforce !!

Thom Parkin ParkinT

💭
Retired from the workforce !!
View GitHub Profile
require 'webrick'
Port = 3000
Directory = Dir::pwd
WEBrick::HTTPServer.new(
Port: Port,
DocumentRoot: Directory
).start
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
require 'json'
require 'open-uri'
require 'uri'
require 'net/http'
CODE_LIMIT = 10
$url = "https://eval.in/"
$languages = {
@ParkinT
ParkinT / README.md
Created April 19, 2014 03:02
Rails app will not start after Capistrano deploy on Digital Ocean Droplet. Error "504 Gateway Timeout"

Symptoms

A previously working Rails app, after a successful Capistrano deploy cycle, stops responding and the server returns the http status code 504.

Troubleshooting

I was able to successfully access the Droplet by way of SSH. Looking at the logs I noticed the unicorn server was having trouble [re]starting.

tail -f /home/unicorn/log/unicorn.log
@ParkinT
ParkinT / Autoparts_Menu.png
Last active August 29, 2015 14:01
Constructing Web-facing pages, from Github Gists, on Bl.ocks.org - Nitrous-Charged
Autoparts_Menu.png
module Bacon
class Context
def expect(obj)
Bacon::Should.new(obj)
end
end
end
@ParkinT
ParkinT / NitrousCharged.png
Last active August 29, 2015 14:01
Recently, I needed to make changes to a MySQL database on a deployed application. My development setup is on a Nitrous.IO box but I found it necessary to make a quick surgical edit of the database {the client had messed up an input and it was easiest to simply edit the record's association}
NitrousCharged.png
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@ParkinT
ParkinT / Net-SSH-Authentication.md
Last active August 29, 2015 14:02
Recently I encountered a strange error in a capistrano script that has always worked in the past. Apparently, it was the result of an update to the net-ssh gem on my Nitrous box

Nitrous-Charged Gist Cap Deploy rollback on Net::SSH::Authentication error

I use Nitrous as my primary development environment. The ability to work on any one of a number of projects at any time and from anywhere is simply too convenient to overlook. {As a matter of fact, I am writing this on a Nitrous box from a hospital bed!}

On a site I have been maintaining and continuously updating (on a drogo - Ruby/Rails Nitrous box), my capistrano deploy script failed one day.

One day my Capistrano deploy for the site returned [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: ...

The error message was a bit confusing because it pointed to SSH authentication

@ParkinT
ParkinT / RailsSites.md
Last active August 23, 2016 00:33
Over the life of the Internet I have created innumerable web sites (many corporate 'internal' sites) and many have become extinct. After discovering Ruby-on-Rails (around 2006) I have become a Serial Rails Developer. When asked "What have you done?" I am at a loss for more than the site on which I most recently worked. This is my personal invent…

Thom Rails Sites

Over the life of the Internet I have created innumerable web sites (many corporate 'internal' sites) and many have become extinct. After discovering Ruby-on-Rails (around 2006) I have become a Serial Rails Developer. When asked "What have you done?" I am at a loss for more than the site on which I most recently worked. This is my personal inventory of Rails Sites (simply as a memory aid for me).

@ParkinT
ParkinT / InteractiveAdventure.md
Last active June 23, 2016 00:56
An Interactive Fictional Story is one where you do not merely observe the action but take an active part in it. As with real life, your decisions have a direct effect on the outcome of the story.

Welcome!

This is merely an example. This short and very simplistic adventure illustrates the concept and the technology involved; including technology challenges which I faced and overcame.

You are strongly encouraged to provide honest comments and suggestions. If you feel the burning desire to write a multi-faceted story, in any genre you please, be sure to make contact and it can be featured here in this manner.

Thanks for your time, interest and feedback.

===