Skip to content

Instantly share code, notes, and snippets.

View robpataki's full-sized avatar

Rob Pataki robpataki

  • Valtech
  • York UK
View GitHub Profile
@robpataki
robpataki / time-string.js
Last active April 16, 2020 14:02
Convert time in milliseconds to human readable hours:minutes:seconds formatedt string
var getTimeString = function(timeInMs) {
var delim = ":";
var hours = Math.ceil(timeInMs / (1000 * 60 * 60) % 60);
var minutes = Math.floor(timeInMs / (1000 * 60) % 60);
var seconds = Math.floor(timeInMs / 1000 % 60);
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
return hours + delim + minutes + delim + seconds;
@robpataki
robpataki / svg-connector.js
Created May 4, 2017 18:40
SVG Connector helps with drawing connections between coordinates using dots and lines
// Colour scheme: https://coolors.co/f61067-5e239d-00f0b5-6decaf-f4f4ed
var NS = 'http://www.w3.org/2000/svg';
var Victor = function(artboardElementSelector) {
if (typeof artboardElementSelector === 'string') {
this.setArtboard(artboardElementSelector);
}
this.connections = {
@robpataki
robpataki / resets.css
Created March 29, 2017 17:27
CSS Resets
//**
// Button reset
//**
button,
input[type="button"],
input[type="submit"] {
// Reset the ugly defaults
-webkit-appearance: none;
background: none;
@robpataki
robpataki / README.md
Last active February 19, 2017 10:43
README file for any project using Webpack and Yarn for asset precompilation and module bundling (OS X only for now)

README file for any project using Webpack 2 and Yarn for asset precompilation and module bundling

Please note, the installation instructions are for OS X only for now. I will update the document as soon as I can to help with Windows/Linux installations too.

Project setup

For the JS assets precompilation we use Webpack 2. To be able to run webpack you'll need a few things to install on your machine, but don't worry, it should be quick and I tried my best to help you with a step by step guide below. Let's start!


@robpataki
robpataki / linode-remove-domain.md
Created February 14, 2017 10:25
Remove a domain served by Apache from your Linode

Remove an unwanted domain served by Apache from your Linode

Remove a domain

sudo a2dissite example.com
sudo rm -rf /root/public/example.com
sudo rm /etc/apache2/sites-available/example.com

sudo service apache2 reload

@robpataki
robpataki / linode-create-new-domain.md
Last active February 14, 2017 10:27
Linode Domain creation steps

Hosting a new domain on Linode with Apache

Setting up the necessary folders and permissions

sudo mkdir -p /root/public/example.com
sudo mkdir -p /root/public/example.com/backup
sudo mkdir -p /root/public/example.com/log
sudo mkdir -p /root/public/example.com/public
sudo chmod -R g+rwxs /root/public/example.com/public
sudo touch /etc/apache2/sites-available/example.com
@robpataki
robpataki / snippets.cson
Last active September 23, 2016 19:51
Atom snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# OS X
*.DS_Store
Icon
Iconr
Icon
*.log
# Python
*.pyc
# OS X
*.DS_Store
Icon
Iconr
Icon
*.log
# Python
*.pyc
/* Prevent overflow scroll bouncing on mac */
/* http://stackoverflow.com/questions/12046315/prevent-overscrolling-of-web-page */
html {
overflow: hidden;
height: 100%;
}
body {
height: 100%;