Skip to content

Instantly share code, notes, and snippets.

View dugancathal's full-sized avatar

TJ Taylor dugancathal

  • Forj
  • Denver, CO
  • 23:15 (UTC -06:00)
View GitHub Profile
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'rack', '~> 1.6'
gem 'api_sim'
end
require 'api_sim'
require 'json'
@dugancathal
dugancathal / capybara_js_driver_setup.rb
Created May 3, 2020 01:11
Had a project where I was developing on both Windows Subsystem for Linux & a Mac. On the windows box, make sure you setup chromedriver and set the port to 9515 (should be the default)
module CapybaraJsDriverSetup
module_function
def is_running_on_windows_subsystem_for_linux?
if which('cmd.exe')
os_version = `cmd.exe /c "systeminfo" | grep "^OS Version"`
!os_version.chomp.empty?
end
end
def create_wsl_driver
CREATE TABLE people
(
id INTEGER AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(255),
last_name VARCHAR(255),
age INTEGER,
email VARCHAR(255)
);
CREATE TABLE pets
@dugancathal
dugancathal / create-repo.sh
Created October 24, 2018 02:12
Create a repo on github using API - ./create-repo.sh $REPONAME [$USERNAME [$TOKEN]]
#!/usr/bin/env bash
CREATE_REPO_LOG_PATH=/tmp/create-repo.log
GITHUB_API=https://api.github.com
HEADERS=(-H 'Content-Type: application/json')
username="${2:-"dugancathal"}"
token="${3:-"$(cat ~/.github-token)"}"
if [[ "${1}" == "" ]]; then
@dugancathal
dugancathal / tjspec-spec.js
Created June 28, 2018 04:24
Just for funzies - you can include all of TJSpec in your codes to get a functioning test framework. DON'T FORGET TO CALL `run()`
const results = TJSpec.describe('A Suite', (it) => {
it('passes with no exceptions', () => {
});
it('throws an exception when an exception fails', (assert) => {
try {
assert.true(false, 'should fail');
} catch (e) {
return assert.true(true);
@dugancathal
dugancathal / angular-spec-helpers.ts
Last active May 27, 2018 20:42
A set of Angular spec helpers.
export const createHost = (childComp, props, moduleMerge: NgModule = {}) => {
@Directive({
selector: '[test-anchor]'
})
class TestAnchor {
constructor(public viewRef: ViewContainerRef) {
}
}
@Component({
@dugancathal
dugancathal / git-to-tracker.rb
Created September 21, 2017 20:16
TRACKER_TOKEN=0293810923 ./git-to-tracker.rb --projects 39483 head~
#!/usr/bin/env ruby
require 'net/http'
require 'optparse'
require 'json'
opts = {}
parser = OptionParser.new do |opt|
opt.on('-p PROJECTS', '--projects=PROJECTS', Array) do |projects|
opts[:projects] = projects
@dugancathal
dugancathal / dependency_injection.go
Created August 20, 2017 02:10
a sample of dependency injection in golang
package main
import (
"encoding/json"
"log"
"net/http"
)
// hashtag framework
type injectionContainer interface {

Keybase proof

I hereby claim:

  • I am dugancathal on github.
  • I am dugancathal (https://keybase.io/dugancathal) on keybase.
  • I have a public key ASAzrmeBA3XXm7CtqTLeQ-mMIb3jDQ35xCKCrFqpNGFSQgo

To claim this, I am signing this object:

@dugancathal
dugancathal / karma.conf.js
Created December 2, 2016 17:14
Basic setup for angular2, typescript, webpack, babel, karma, jasmine
// Karma configuration
// Generated on Wed Nov 30 2016 09:30:14 GMT-0700 (MST)
var webpackConfig = require('./webpack.config.js');
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',