Skip to content

Instantly share code, notes, and snippets.

View gpincheiraa's full-sized avatar

Gonzalo Pincheira Arancibia gpincheiraa

View GitHub Profile
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;
{
"name": "countries-app",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
import request from 'request-promise';
var token = process.env.SBIF_TOKEN_URL,
api_url = process.env.SBIF_API_URL;
class SbifApi{
constructor(SbifModel){
//map remote methods to class methods. Set an extra this using the .bind function
SbifModel.uf = this.getData.bind(SbifModel, 'uf');
SbifModel.utm = this.getData.bind(SbifModel, 'utm');
module.exports = function(Sbif) {
var request = require('request-promise'),
token = process.env.SBIF_TOKEN_URL,
api_url = process.env.SBIF_API_URL;
// UTM ---------------------------------------------
Sbif.utm = function(params, cb) {
makeRequest('utm',{}).then(function(res) {
cb(null, JSON.parse(res).UTMs[0]);
@gpincheiraa
gpincheiraa / gist:d267d82dba92a042ea970d5f8067d00d
Created August 23, 2016 03:31
Draw for loopback model es6 defiition
import request from 'request-promise';
var token = process.env.SBIF_TOKEN_URL,
api_url = process.env.SBIF_API_URL;
class SbifApi{
constructor(SbifModel){
//map remote methods to class methods. Set an extra this using the .bind function
SbifModel.uf = this.getData.bind(SbifModel, 'uf');
SbifModel.utm = this.getData.bind(SbifModel, 'utm');
@gpincheiraa
gpincheiraa / gist:9b8c349fe1e5b6408cb0b469ac1f9060
Created August 23, 2016 03:31
Draw for loopback model es6 defiition
import request from 'request-promise';
var token = process.env.SBIF_TOKEN_URL,
api_url = process.env.SBIF_API_URL;
class SbifApi{
constructor(SbifModel){
//map remote methods to class methods. Set an extra this using the .bind function
SbifModel.uf = this.getData.bind(SbifModel, 'uf');
SbifModel.utm = this.getData.bind(SbifModel, 'utm');
@gpincheiraa
gpincheiraa / auth.service.js
Created September 4, 2016 15:37
Auth Service
(function(){
'use strict';
angular
.module('MedicionAguaAdmin')
.service('AuthService', Service);
Service.$inject = ['$resource','$cookies','APP_SETTINGS'];
@gpincheiraa
gpincheiraa / introrx.md
Created October 19, 2016 20:08 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@gpincheiraa
gpincheiraa / package.json
Last active October 8, 2017 00:36
package.json - First Impressions using jest for TDD over AngularJS > 1.5.x  - Part I
{
"name": "angularjs-tdd-jest",
"version": "0.1.0",
"scripts": {
"start": "webpack-dev-server",
"test": "cross-env NODE_PATH=./src jest --coverage --verbose",
"tdd": "cross-env NODE_PATH=./src jest --watch --verbose",
"check-coverage": "npm test | http-server -so -p 9000 coverage/lcov-report"
},
"dependencies": {
@gpincheiraa
gpincheiraa / .babelrc
Last active September 27, 2017 00:02
.babelrc - First Impressions using jest for TDD over AngularJS > 1.5.x — Part I
{
"presets": [
"es2015",
"stage-3"
]
}