Skip to content

Instantly share code, notes, and snippets.

require 'active_record'
ActiveRecord::Base.logger = Logger.new( STDOUT )
ActiveRecord::Base.establish_connection(
:adapter => "postgresql",
:host => "localhost",
:username => "philco",
:password => "",
:database => "amazon_db"
@davidmccoy
davidmccoy / sinatra
Last active August 29, 2015 13:57
sinatra intro
require 'sinatra'
require 'sinatra/reloader' if development?
require 'pry'
require 'pg'
require 'active_record'
# require_relative ''
ActiveRecord::Base.logger = Logger.new( STDOUT )
ActiveRecord::Base.establish_connection(
@davidmccoy
davidmccoy / html sinatra layout
Created March 21, 2014 14:04
html layout for sinatra
<html>
<head>
<title></title>
<meta charset="utf-8">
</head>
<body>
<%= yield %>
</body>
</html>

CONTEXT

WHAT USER STORY YOU ARE WORKING ON:

I am working on the user story "User wants to log in."

WHAT YOU ARE TRYING TO DO:

I am trying to have the user update their profile.

group :development, :test do
gem 'pry-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'guard'
gem 'guard-rspec'
gem 'guard-bundler', require: false
gem 'terminal-notifier-guard'
gem 'shoulda-matchers'
gem 'capybara'
development: &defaults
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
username: <%= `echo $USER`.chomp %>
password:
database: <%= File.basename(Rails.root) %>_development
test:
jQuery(document).ready(function() {
/*
Snippet from http://stackoverflow.com/a/5918791
*/
navigator.sayswho = (function(){
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
@davidmccoy
davidmccoy / Contract Killer 3.md
Last active August 29, 2015 14:26
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@davidmccoy
davidmccoy / Google-Sheet-Form-Post.md
Created June 10, 2017 01:16 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Run example

You should be able to just open index.html in your browser and test locally.

However if there are some permissions errors you can make a quick html server with python. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer. By default this creates a local server at localhost:8000

// original from: http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
// original gist: https://gist.github.com/willpatera/ee41ae374d3c9839c2d6
function doGet(e){
return handleResponse(e);
}
// Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";