Skip to content

Instantly share code, notes, and snippets.

View luhof's full-sized avatar
🍕
www.lucas.cool

Lucas Hörand luhof

🍕
www.lucas.cool
View GitHub Profile
@luhof
luhof / bignumberformatFilter.js
Last active August 5, 2016 14:44
Angular large number format filter that keeps 3 digits + letter only
// adapted from https://gist.github.com/timgit/7bc5896f5297301afb02
app.filter('bigNumber', function(){
return function(number){
if(number === null) return null;
if(number === 0) return "0";
//precision level
var rounder = 100;
@luhof
luhof / angular-loop-promises-light.js
Last active September 25, 2017 09:34
Loop through angular promises and calls new func when they are all done
// simpler version
var defer = $q.defer();
var promises = [];
angular.forEach(items, function(item){
promises.push(api.randomFunc(item));
});
$q.all(promises).then(function(ret){
/* do something fancy here */
@luhof
luhof / retina_canvas.js
Created June 15, 2015 14:45
Retina support for canvas. Welcome, sharp, clean fonts and edges !!
// canvas needs "style" about its size attribute
var c = document.getElementById("canvas");
var ctx = c.getContext("2d");
if (window.devicePixelRatio > 1) {
var canvasWidth = c.width;
var canvasHeight = c.height;
c.width = canvasWidth * window.devicePixelRatio;
@luhof
luhof / Makefile
Last active August 4, 2016 15:48
Makefile template for Mac OS X OpenGL/SDL C projects
### MAC OS X ONLY OpenGL/SDL Makefile ! Tested on Yosemite
# adapted by Lucas Horand - http://luhof.fr - from a random chunk of code by Laurent Noël
# / ! \ You need a basic architecture with src, obj, includes folders / ! \
# app will be created in bin folder.
###
### FRIENDLY REMINDERS :
# Use homebrew to install libs : http://brew.sh
# before including OpenGL check #ifdef __APPLE__ !
###