Skip to content

Instantly share code, notes, and snippets.

View dbongo's full-sized avatar

Michael Crowther dbongo

View GitHub Profile
@dbongo
dbongo / canonicalLink.js
Created September 6, 2024 15:55
Canonical Link Helper
# The Mandelbrot Set for Ruby by Michael Crowther
#
# Based on "The Mandelbrot Set" example by Daniel Shiffman for Processing 3+
# (https://processing.org/examples/mandelbrot.html)
#
# size(640, 360);
# noLoop();
# background(255);
#
# // Establish a range of values on the complex plane
@dbongo
dbongo / vpngen.rb
Created December 17, 2019 21:48 — forked from arnehormann/vpngen.rb
Configuration file generator for OpenVPN which also sets up a ca and generates keys.
#!/usr/bin/env ruby
# Just call this without arguments. It will show a friendly help text.
# For xterm-256color, it will even use colors for some commands!
class AppConfig
@@default_remote = 'vpn.example.com'
@@default_networks = '10.0.0.0/24>192.168.1.0/24'
@@default_subject = '/C=US/ST=CA/L=San Francisco/O=Example/OU=/CN={{name}}'
@dbongo
dbongo / optparse-template.rb
Created August 15, 2019 18:20 — forked from rtomayko/optparse-template.rb
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
@dbongo
dbongo / bfile.rb
Created April 29, 2019 03:36 — forked from skord/bfile.rb
A simple file server and uploader using sinatra
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'haml'
$pwd = ENV['PWD']
if File.exists?(ARGV.last)
if ARGV.last != 'bfile.rb'
@dbongo
dbongo / Take_Home_Assignment.md
Created April 4, 2019 14:17
Take Home Assignment

Image Preview Service

Summary - TODO

Image Preview Service

  • How to Upload
  • Resize and Reformat
  • Image Storage
  • API Endpoints
  • Preview Storage

Defining A Class

1. Identify the namespace

2. Identify the inputs

What parameters need to be passed in to instantiate the class?

  • The inputs must be essential to the classes purpose
  • Any inputs that are not essential indicate the presence of accidental complexity
  • Inputs should be optional wherever a suitable default can be determined
@dbongo
dbongo / database_cleaner.rb
Created April 8, 2016 16:52 — forked from jsteiner/database_cleaner.rb
Database Cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
<div contenteditable="true" class="editable" data-editable-input-id="input-name"></div>
<input id="input-name" type="text" name="input-name" value="" placeholder="Don't Touch Me" />
$(document).ready(function() {
// Loop through each of the empty .editable elements and add filler edit text.
$('.editable:empty').each(function(){
$(this).text('Edit Me');
});
// On .editable blur() - when a user clicks off of an .editable element take it's text and pass it to the corresponding input.
$('.editable').blur(function() {
var editableContent = $(this).text();