Skip to content

Instantly share code, notes, and snippets.

View mrstebo's full-sized avatar
💻

Steven Atkinson mrstebo

💻
View GitHub Profile
@mrstebo
mrstebo / fakergem-build-routes.rb
Created June 2, 2020 15:33
i-lazy-dev-i-build-scripts-write-code-3
puts "app.use(require('./routes/#{route_name}'));"
@mrstebo
mrstebo / fakergem-build-routes.rb
Created June 2, 2020 15:32
i-lazy-dev-i-build-scripts-write-code-2
File.open("./routes/#{route_name}.js", 'w') do |f|
f.puts TEMPLATE
.gsub(/\{route_name\}/, route_name)
.gsub(/\{properties\}/, properties.join(",\n "));
end
@mrstebo
mrstebo / fakergem-build-routes.rb
Created June 2, 2020 15:32
i-lazy-dev-i-build-scripts-write-code-1
route_name = File.basename(doc, '.md')
properties = File.open(doc, 'r', &:read).scan(/^Faker\.(\w+)\.(\w+)/).map {|match|
"#{match[1]}: Faker.#{match[0]}.#{match[1]}()"
}.uniq
@mrstebo
mrstebo / HomeModule.cs
Created June 2, 2020 15:19
getting-started-building-simple-nancy-api-2
using Nancy;
namespace NancyApp
{
public class HomeModule : NancyModule
{
public HomeModule()
: base("/")
{
Get["/"] = Index;
@mrstebo
mrstebo / Startup.cs
Created June 2, 2020 15:19
getting-started-building-simple-nancy-api-1
using Owin;
namespace Tempest.Authorization.Web
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseNancy();
}
@mrstebo
mrstebo / docker-compose.yml
Created June 2, 2020 12:47
ruby-rails-postgresql-using-docker-compose-2
version: '2'
services:
db:
image: postgres:9.4.1
ports:
- "5432:5432"
web:
build: .
@mrstebo
mrstebo / database.yml
Created June 2, 2020 12:46
ruby-rails-postgresql-using-docker-compose-1
default: &default
adapter: postgresql
pool: 5
username: postgres
host: db
development:
<<: *default
database: my-awesome-app_development
@mrstebo
mrstebo / Dockerfile
Created June 2, 2020 12:35
developing-ruby-rails-using-docker-windows-1
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential
# for postgres
RUN apt-get install -y libpq-dev
# for nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev
@mrstebo
mrstebo / HomeModule.cs
Created June 2, 2020 12:27
lets-play-with-nancy-2
using Nancy;
namespace NancyBooks.Modules
{
public class HomeModule : NancyModule
{
public HomeModule()
{
Get["/"] = _ =>
{
@mrstebo
mrstebo / Startup.cs
Created June 2, 2020 12:26
lets-play-with-nancy-1
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(NancyBooks.Startup))]
namespace NancyBooks
{
public class Startup
{
public void Configuration(IAppBuilder app)
{