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 / resizeVideo.js
Created November 25, 2014 18:57
This script will always make sure that the video is covering the browser window and it is centred, whilst the aspect ratio is maintained.
function resizeVideo() {
var videoEl = document.getElementsByTagName('video')[0];
var videoOriginalWidth = 854;
var videoOriginalHeight = 480;
var videoRatio = videoOriginalWidth/videoOriginalHeight;
var winWidth = window.innerWidth;
var winHeight = window.innerHeight;
var videoWidth;
var videoHeight;
var videoDimensionMultiplier = 1.1;
@robpataki
robpataki / imageload.js
Created December 27, 2014 15:32
jQuery image load handling
var img = new Image();
$(img).on('load', function(e){
// Your code here
}).each(function() {
if(this.complete) $(this).load();
});
img.src = "http://dummyimage.com/600x400";
@robpataki
robpataki / .profile
Last active August 2, 2018 10:30
Bash profile
export PATH="/usr/local/bin:usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/etc:/usr/local/mysql/bin:/.rbenv/bin:$PATH"
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home"
# Load SSH keys
ssh-add -K ~/.ssh/id_rsa
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
@robpataki
robpataki / Preferences.sublime-settings
Last active March 8, 2017 10:14
Sublime Text 3 preferences
{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme",
"ignored_packages":
[
"Vintage"
],
"font_size": 16,
// The number of spaces a tab is considered equal to
"tab_size": 2,
// Set to true to insert spaces when tab is pressed
@robpataki
robpataki / xld_filename.md
Last active August 25, 2023 11:38
File naming convention for XLD encoding

Compilations:

%A - %T  -  %n - %a - %t

Albums by 1 artist

%A - %T  -  %n - %t
@robpataki
robpataki / .gitconfig
Created May 28, 2015 16:23
.gitconfig
[core]
excludesfile = /Users/rob/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[user]
name =
@robpataki
robpataki / singie.js
Created July 18, 2015 22:10
Very simple implementation of the singleton pattern in requirejs
define(
[],
function() {
'use strict';
var instance = null;
function Singie() {
@robpataki
robpataki / pixi_mc.js
Last active August 29, 2015 14:25
Demonstrating sweat free movieclip creation and clean up in PIXI
/*
This snippet requires PIXI and underscoreJS to work;
The good thing about this approach is that you don't have to manually set the number of total frames
used and file name references used in the animation to build up your texture data; and this technique
also makes it a lot easier to remove the BaseTextures from TextureCache once you no longer need them,
so that you can free up precious memory!
Use this snippet with caution, I quickly scribbled it in, so not sure if it breaks, please let me know
in the comments if you found it useful or found an error. Cheers!
@robpataki
robpataki / retina.css
Created September 10, 2015 15:00
Retina background image CSS
.icon {
background-image: url("social-icons.png") 0 0 no-repeat;
}
/* 1.25 dpr and up - including retina devices */
@media
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi){
.icon {
background-image: url("social-icons@2x.png");
[
{ "keys": ["super+shift+forward_slash"], "command": "toggle_comment", "args": { "block": true } }
]