Skip to content

Instantly share code, notes, and snippets.

View matiasfha's full-sized avatar

Matías Hernández Arellano matiasfha

View GitHub Profile
@matiasfha
matiasfha / angularInit.js
Created November 4, 2015 20:33
angularInit method
function angularInit(element, bootstrap) {
var appElement,
module,
config = {};
// The element `element` has priority over any other element
forEach(ngAttrPrefixes, function(prefix) {
var name = prefix + 'app';
if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
@matiasfha
matiasfha / bootstrap.js
Created November 5, 2015 14:20
Angular bootstrap method
function bootstrap(element, modules, config) {
if (!isObject(config)) config = {};
var defaultConfig = {
strictDi: false
};
config = extend(defaultConfig, config);
var doBootstrap = function() {
element = jqLite(element);
if (element.injector()) {
@matiasfha
matiasfha / dc.js
Created November 13, 2015 13:20
Directive vs Component
// Directive method
module.directive(name, fn);
// Component method
module.component(name, options);
@matiasfha
matiasfha / routeLoaderDirective.js
Last active November 13, 2015 13:52
Route loader directive
function routeLoaderCtrl ($rootScope) {
$rootScope.$on('$routeChangeStart', function (){
this.routeLoading = true;
}.bind(this));
$rootScope.$on('$routeChangeSuccess', function (){
this.routeLoading = false;
}.bind(this));
}
@matiasfha
matiasfha / dc-definition.js
Created November 13, 2015 13:50
Directive vs component definition
//Directive syntax
function routeLoaderDirective () {
//directive definition
}
angular
.module('core')
.directive('routeLoader', routeLoaderDirective);
/*------------------------------------------------------------*/
@matiasfha
matiasfha / routeLoaderComponente.js
Created November 13, 2015 14:45
route loader component
function routeLoaderCtrl ($rootScope) {
$rootScope.$on('$routeChangeStart', function (){
this.routeLoading = true;
}.bind(this));
$rootScope.$on('$routeChangeSuccess', function (){
this.routeLoading = false;
}.bind(this));
}
module Components.Navbar.Style exposing (..)
import Css exposing (..)
import Css.Elements exposing (..)
import Css.Namespace exposing (namespace)
import Html.CssHelpers exposing (withNamespace)
type CssIds
= NavbarContainer
| Header
module Model exposing (..)
import Routing
import Components.Productos.Model as Products
type alias Model =
{ route: Routing.Route
, products: Products.Model
}
module Components.Products.Model exposing (..)
type alias Product =
{id : Int
,image: String
,title: String
,description: String
,price: Int
,quality: String
}
{
"flight_type":"domestic",
"num_passengers":1,
"pickup_datetime":null,
"flight_datetime":"2017-04-12T08:30:00-07:00",
"search_id":"6d0da58c3afd4f59b1c71d353cdfa163",
"results":[
{
"result_id":"1b074ec7117f4291aa2278fecd057a88",
"total_price":{