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 / video-ready.js
Last active September 30, 2015 16:10
Handle video loading
function onVideoReady() {
video.play();
}
/* Solution #1
First check for the videos readyState, if not ready add an event
listener to 'canplaythrough' event
*/
if(video.readyState < 4) {
video.addEventListener('canplaythrough', function() {
@robpataki
robpataki / MediaResizer.js
Last active February 26, 2016 11:34
Resize media (video or image) to imitate 'background cover' or 'background contain' behaviour in JavaScript
define([
'jquery',
'underscore',
'brewser'
],
function(
$,
_,
brewser
/* Prevent overflow scroll bouncing on mac */
/* http://stackoverflow.com/questions/12046315/prevent-overscrolling-of-web-page */
html {
overflow: hidden;
height: 100%;
}
body {
height: 100%;
# OS X
*.DS_Store
Icon
Iconr
Icon
*.log
# Python
*.pyc
# OS X
*.DS_Store
Icon
Iconr
Icon
*.log
# Python
*.pyc
@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:
#
@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 / 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 / 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 / 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;