Skip to content

Instantly share code, notes, and snippets.

View federicofazzeri's full-sized avatar

Federico Fazzeri federicofazzeri

  • canada
View GitHub Profile
@federicofazzeri
federicofazzeri / Gruntfile.js
Created February 24, 2017 18:50
A Grunt task with no dependencies to serve static files (optionally set port and staticBasePath: server: { port: 3300, staticBasePath: './build' })
module.exports = function(grunt) {
var config = {
watch: {},
server: {}
};
grunt.initConfig(config);
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadTasks('tasks');
grunt.registerTask('default', ['server', 'watch']);
};
@federicofazzeri
federicofazzeri / composer.factory.js
Created February 24, 2017 18:47
A simple Angular service for function composition
(function(window, angular) {
'use strict';
/****
* Simple composition factory for Angular 1x
*****/
var composer = angular.module('composerModule', []);
composer.factory('Composer', Composer);
@federicofazzeri
federicofazzeri / controls.js
Created February 24, 2017 18:44
Drag and drop bouncing ball in RxJs
(function(Observable, eleId, dom) {
var ball = dom.getElementById(eleId),
mouseOverBall = Observable.fromEvent(ball, 'mousedown'),
mouseUp = Observable.fromEvent(dom, "mouseup"),
dragBall = Observable.fromEvent(dom, 'mousemove'),
resize = Observable.fromEvent(window, 'resize'),
stylesheet = dom.styleSheets[0],
baseY = ((css) => {
try {
@federicofazzeri
federicofazzeri / list-filter.factory.js
Created February 24, 2017 18:38
Simple list filter without "bothering" angular $scope
(function(window, angular) {
'use strict';
/**
* Simple list filter without "bothering" angular $scope
* I used OLOO as a OO Js style (instead of the classic prototypal inheritance)
*/
var listFilter = angular.module('listFilter', []);
@federicofazzeri
federicofazzeri / angular.aria-live.js
Last active February 21, 2017 14:58
aria-live-announcements an angular service for running aria live announcements Take a look at example.html for an example of how to use it in a directive
(function(window, angular) {
'use strict';
/**
*
* The `ariaLive` module provides a service for running aria live announcements.
* It creates an empty paragraph only "visible" to screen readers.
*
*/