Skip to content

Instantly share code, notes, and snippets.

@wojciak
wojciak / pixiRetinaResize.js
Created July 3, 2014 20:04
A base implementation of properly handling viewport resize and rotation in PIXI.js (including retina support).
/**
* The width and height to which our graphic assets are designed for
* Keep in mind retina resolutions and remember to provide 2xWidth 2xHeight assets for them
*/
var targetWidth = 1024;
var targetHeight = 768;
/**
* The main (root) container on the stage
* You should always have a master container on your stage
@wojciak
wojciak / uiRouterSeamlessRedirects.js
Created July 2, 2014 13:50
UI router seamless redirects
// Feature routing - here we can create seamless redirects based on features
app.run(/* ngInject */ function ($state, $rootScope) { // ngAnnotate
$rootScope.$on('$stateChangeStart', function (e, toState) {
// 1. Dashboard disabled - when we want to go to it ("root" state) we should get a project list instead
if (toState.name === 'root') {
if (!features.active('dashboard')) { // an example feature checker
$state.go('root.project.list');
e.preventDefault();
}
}
function loadSound(name) {
function () {
'use strict';
var init,
Howl = Howl || null,
//change this
assetSource = 'path/to/sounds';
@wojciak
wojciak / lithiumModule
Last active December 27, 2015 10:09
LithiumJS module definition
/*global _li*/
(function (module) {
'use strict';
var moduleName = module.get('name'),
init;
init = function () {
module.publish(moduleName + '.events'); // fire other exposed module