Skip to content

Instantly share code, notes, and snippets.


Mike Fotinakis fotinakis

View GitHub Profile
fotinakis / nginx-default-site.conf
Created May 13, 2021
Percy GitHub Enterprise - example nginx proxy configuration
View nginx-default-site.conf
daemon off;
events {
worker_connections 1024;
http {
server {
listen 443 ssl;
location / {
fotinakis / example.rb
Created Sep 22, 2020
Percy Projects API example
View example.rb
# Could also use the low-level ruby API client to make these calls:
fotinakis / canvas-to-image.js
Created Apr 17, 2019
Convert WebGL canvas to static img in place
View canvas-to-image.js
function canvasToImage(canvas) {
const {top, left, height, width} = canvas.getBoundingClientRect();
const mapImage = document.createElement('img');
mapImage.setAttribute('src', canvas.toDataURL('image/png'));
mapImage.setAttribute('style', `position: absolute; z-index: 2147483638; top: ${top}px; left: ${left}px; width: ${width}px; height: ${height}px;`);
// Convert all canvas elements on the page to images.
document.querySelectorAll('canvas').forEach((canvas) => {
View gist:ea3e315d99b3a3d301fd98b74e5c0728
git config --global push.default current
git config --global pull.default current
fotinakis / percy_loader.rb
Created Oct 3, 2017
Custom Percy::Capybara SprocketsLoader that changes path
View percy_loader.rb
class CustomLoader < Percy::Capybara::Loaders::SprocketsLoader
def build_resources do |resource|
resource.resource_url = resource.resource_url.gsub('//localhost:3000/', '/')
fotinakis / circle ci
Last active Sep 27, 2018
Percy manual build finalization for Circle 2.0 and other parallel CI workflows.
View circle ci
# ...
- image: circleci/node:10
- run: npm install percy-client
- run: node .circleci/percy-finalize.js
fotinakis / gist:ec5a304286738f7e8f401289f2d6b1d0
Last active May 17, 2017
percy-capybara manual parallelization setup
View gist:ec5a304286738f7e8f401289f2d6b1d0
# Tell Percy that this is a parallelized build. Because we separately finalize
# Percy builds, this should remain "2" no matter the actual number of nodes.
# Set this environment variable:
# In your spec_helper, only call `initialize_build` and not finalize:
config.before(:suite) { Percy::Capybara.initialize_build }
# Do not call `finalize_build`.
fotinakis / native-loader-remote-example.rb
Created Apr 24, 2017
Percy native loader remote example
View native-loader-remote-example.rb
# Example to use Percy against a remote host.
# Requires: poltergeist gem, and phantomjs.
# This uses the percy-capybara native loader, which is slower and less accurate
# than other loaders. See:
require 'percy/capybara'
require 'capybara/poltergeist'
fotinakis / zoomTestContainer.js
Created Nov 29, 2016
Ember zoomTestContainer
View zoomTestContainer.js
$('#ember-testing-container').css('height', '100%');
$('#ember-testing-container').css('width', '100%');
$('#ember-testing').css('zoom', '100%');
fotinakis / bash
Created Sep 30, 2016
List numbers of connection states with netstat
View bash
netstat -nat | awk '{print $6}' | sort | uniq -c | sort -n