Skip to content

Instantly share code, notes, and snippets.

View dajulia3's full-sized avatar

David Julia dajulia3

View GitHub Profile
@dajulia3
dajulia3 / Dockerfile.playwright
Created May 7, 2020 12:10
dockerfile for playwright and ruby and whatnot
################################################
# Compile with:
# sudo docker build -t microsoft/playwright:bionic -f Dockerfile.bionic .
#
# Run with:
# sudo docker run -d -p --rm --name playwright microsoft/playwright:bionic
#
#################################################
FROM ubuntu:bionic
@dajulia3
dajulia3 / Visualize Dot Files in browser
Created April 23, 2020 15:23
HTML to visualize dot file in browser
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v5.min.js"></script>
<script src="https://unpkg.com/@hpcc-js/wasm@0.3.6/dist/index.min.js"></script>
<script src="https://unpkg.com/d3-graphviz@3.0.0/build/d3-graphviz.js"></script>
<script type="text/javascript">
dependencyData='digraph {a -> b}' //REPLACE ME WITH THE REAL DATA
</script>
<div id="graph" style="text-align: center;"></div>
@dajulia3
dajulia3 / find_parent_upwards.sh
Created September 15, 2019 08:08
Bash script to find the parent directory of a file or dir that is located above the working dir in the hierarchy
find_parent_upwards() {
local look=${PWD%/}
while [[ -n $look ]]; do
[[ -e $look/$1 ]] && {
printf '%s\n' "$look"
return
}
look=${look%/*}
package com.djulia.session.domain;
import java.util.Objects;
public class Restaurant {
private final String name;
private final String ownerName;
private final String headChefName;
private final String cusineType;
private final String shortDescription;
FROM ubuntu:15.10
RUN rm /bin/sh && ln -s /bin/bash /bin/sh; \
apt-get update;\
apt-get install -y openjdk-8-jdk curl; \
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3; \
\curl -sSL https://get.rvm.io | bash -s stable; \
rvm install 2.1.1 ; \
gem install pact_broker; \
package com.djulia.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@dajulia3
dajulia3 / Working port forwarding for docker registry
Last active February 6, 2016 22:39
How to make a private registry accessible from inside docker-machine
#NOTE: our ci machine currently has a weird pfctl rule that I put in place on friday, so port 5000 is not working.
#Remove that rule, and this should work.
docker-machine create --driver virtualbox --engine-insecure-registry ci:5000 default #Run on all agents/dev boxes
#THE BELOW LINES ONLY APPLY TO THE CI SERVER:
docker-machine stop default
vboxmanage modifyvm "default" --natpf1 "tcp-port5000,tcp,,5000,,5000";
docker-machine start default
docker-machine ssh default "sudo -- sh -c 'echo 10.0.2.2 ci >> /etc/hosts'"
@dajulia3
dajulia3 / spec_helper.rb
Last active August 29, 2015 14:02
use_route without monkey patching for engine controller tests
#......
#A bunch of spec_helper code....
Rspec.configure do |config|
module UseRoutesForControllerTests
def self.included(base)
base.class_eval do
routes { MyEngine::Engine.routes }
end
end
end
@dajulia3
dajulia3 / listings_controller.rb
Last active March 30, 2023 01:36
Service locator with Rails Initializer for rails service loader that loads the services from a config file.
class ListingsController < ApplicationController
def index
movie_listing_service = ServiceLocator.get_service_instance(:MovieListing)
@available_movies = movie_listing_service.available_movies
render nothing: true #this is just an example don't get hung up on it :)
end