Skip to content

Instantly share code, notes, and snippets.

View jackrugile's full-sized avatar

Jack Rugile jackrugile

View GitHub Profile
@jackrugile
jackrugile / SubdivisionModifier.js
Created June 5, 2017 19:24
Three.js Subdivision Modifier with option to retain original shape
/*
* @author zz85 / http://twitter.com/blurspline / http://www.lab4games.net/zz85/blog
* @author centerionware / http://www.centerionware.com
*
* Subdivision Geometry Modifier
* using Loop Subdivision Scheme
*
* References:
* http://graphics.stanford.edu/~mdfisher/subdivision.html
* http://www.holmes3d.net/graphics/subdivision/
@jackrugile
jackrugile / jacks-first-custom-pc.md
Last active April 1, 2020 20:21
Some notes about my experience building my first custom PC.

Jack's First Custom PC

I've been wanting to build my own custom PC since high school, and I finally did it. It was always intimidating to me because it seemed so complicated and easy to mess up. I was afraid of buying incompatible parts, or putting them together in the wrong way.

I grew up playing PC games more so than console, but over the last few years, I've been mainly on PS4. I'm a huge fan of Overwatch by Blizzard, and I've been playing that a ton on console. I wanted to give it a try on PC, so that rekindled my interest in building my own machine.

Overwatch doesn't have insane system requirements, but I still wanted it to run smooth, so I tried to find the perfect balance between performance and budget. The nice thing about PC parts is that the prices seem to dramatically go down if you're willing to get slightly older parts (1-2 years old). Buying the newest and shiniest would have been overkill for me, and it would have overkilled my bank account.

After reading enough articles and watching enou

@jackrugile
jackrugile / calc.js
Last active January 8, 2019 15:38
Some common calculation helpers I use in a lot of my demos and games.
class Calc {
/*
------------------------------------------
| rand:float - returns random float
|
| min:number - minimum value
| max:number - maximum value
|
| Get a random float between two values
@jackrugile
jackrugile / vue-inline-svg-loader.md
Last active August 30, 2018 19:06
Instructions for loading SVGs inline from a file reference in Vue.js

Install svg-inline-loader

npm install svg-inline-loader --save-dev

Webpack Config

In module rules in webpack config, add this loader:

@jackrugile
jackrugile / setLimitedInterval.js
Last active October 9, 2017 20:56
A helper function that is the same as setInterval(), but with a limit parameter.
function setLimitedInterval(func, delay, limit) {
let i = 0;
let interval = setInterval(() => {
func(i);
if(++i >= limit) clearInterval(interval);
}, delay);
return interval;
}
// Example: console.log() the current iteration number 3 times, every second
@jackrugile
jackrugile / index.js
Last active March 8, 2017 00:23
Normalize center transform-origin cross-browser issue
function centerTransformOrigin(elems) {
for(let i = 0; i < elems.length; i++) {
let bcr = elems[i].getBBox();
elems[i].style.transformOrigin = `${bcr.x + bcr.width / 2}px ${bcr.y + bcr.height / 2}px`;
}
}
@jackrugile
jackrugile / canvas-blurred-rect.js
Last active November 5, 2016 07:22
Create contained blurred rectangle with HTML 5 canvas
function blurredRect( w, h, blur, color ) {
let c = document.createElement( 'canvas' );
let ctx = c.getContext( '2d' );
c.width = w;
c.height = h;
ctx.fillStyle = color;
ctx.shadowBlur = blur;
ctx.shadowColor = color;
ctx.shadowOffsetX = w;
ctx.shadowOffsetY = h;

Keybase proof

I hereby claim:

  • I am jackrugile on github.
  • I am jackrugile (https://keybase.io/jackrugile) on keybase.
  • I have a public key whose fingerprint is 3587 DA94 7B25 D76A E723 5757 05BF ACC4 A7AC 936C

To claim this, I am signing this object:

@jackrugile
jackrugile / gulpfile.js
Created April 4, 2016 22:59
Gulp Moving Files
gulp.task( 'fonts', function() {
gulp.src('src/fnt/**/*')
.pipe( gulp.dest( dest + 'fnt' ) );
});
gulp.task('watch', function() {
gulp.watch( 'src/fnt/**/*', [ 'fonts' ] );
});
function onGLC(glc) {
glc.loop();
glc.size(400, 400);
glc.setDuration(2.5);
glc.setFPS(60);
glc.setMode('bounce');
glc.setEasing(false);
var list = glc.renderList,
width = glc.w,
height = glc.h,