Skip to content

Instantly share code, notes, and snippets.

@cesarandreu
cesarandreu / gist:7817006
Created December 6, 2013 01:04
An awesome gruntfile that does livereload with jade files and lets you proxy. HAIL GRUNT!~
// Generated on 2013-11-29 using generator-angular 0.6.0-rc.2
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
// PROXY STUFF
@cesarandreu
cesarandreu / app.js
Last active January 1, 2016 19:49 — forked from elbuo8/app.js
angular.module('HypeM', ['ionic', 'ngResource', 'ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'partials/player.html',
controller: 'PlayerCtrl'
}).
when('/latest', {
templateUrl: 'partials/player.html',
@cesarandreu
cesarandreu / app.js
Last active January 1, 2016 19:49 — forked from elbuo8/app.js
angular.module('HypeM', ['ionic', 'ngResource', 'ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'partials/player.html',
controller: 'PlayerCtrl'
}).
when('/latest', {
templateUrl: 'partials/player.html',
@cesarandreu
cesarandreu / AngularJS Provider Test Example
Last active February 6, 2018 17:59
Example of how you can test your AngularJS providers.
Look at the README.
@cesarandreu
cesarandreu / debounce.js
Created January 30, 2014 21:37
Native debouncing for AngularJS
'use strict';
angular.module('debounce').factory('debounce', function($timeout, $q) {
return function(func, wait, immediate) {
var timeout;
var deferred = $q.defer();
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
@cesarandreu
cesarandreu / example.html
Last active August 29, 2015 13:55
Lets you set anchor tags that cause a full page reload instead of letting ngRoute handle the page-change
<!-- This link will be handled by ngRoute -->
<a href="/angularpage">AngularJS Link</a>
<!-- With directive, this link will cause a full page load and may be handled by your server -->
<a href="/railspage" trd-external>Rails Link</a>
<!-- Manually, this link will cause a full page load and may be handled by your server -->
<a href="/railspage" target="_self">Rails Link</a>
'use strict';
angular.module('debounce').factory('debounce', function($timeout, $q) {
return function(func, wait, immediate) {
var timeout;
var deferred = $q.defer();
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
// 1. How to check if one array has all elements of another?
var importedEmails = ['[email protected]', '[email protected]'],
existingEmails = ['[email protected]', '[email protected]', '[email protected]'];
if(!_.difference(importedEmails, existingEmails).length) console.log('already imported')
// > already imported
// **********************************************************
// 2. How to find what elements are common to two arrays?

Keybase proof

I hereby claim:

  • I am cesarandreu on github.
  • I am cesarandreu (https://keybase.io/cesarandreu) on keybase.
  • I have a public key whose fingerprint is 6D79 23DA 74B6 5C5C 1D91 0AC6 F99C 5388 AD58 560B

To claim this, I am signing this object:

{
"node": true,
"browser": true,
"esnext": true,
"bitwise": false,
"camelcase": false,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,