Skip to content

Instantly share code, notes, and snippets.

View jbgraug's full-sized avatar

Juan jbgraug

  • Gigigo (Econocom group)
  • Valencia, Spain
View GitHub Profile
const isMultipleOf6 = val => val % 6 === 0
const isMultpleOf10 = val => val % 10 === 0
const isPair = val => val % 2 === 0
let fcall = 0
const filters = (...args) => value =>
args.reduce((previous, current, index) => {
fcall += 1
const calc = current(value)
@jbgraug
jbgraug / README.md
Created August 17, 2016 15:49 — forked from krimple/README.md
Test and class under test for Http mocking - Angular 2 beta 1

This snippet is a working example of a test against the Http service in Angular 2.0.

It is a very simple test, and provides an example of how to:

  • Provide the right wiring to the test injector
  • Inject the fake XHRBackend (i.e. MockBackend)
  • Define a potential request
  • Run the request in the framework
  • Set expectations on the result
@jbgraug
jbgraug / observable-request-service-spec.ts
Created August 17, 2016 15:48 — forked from vladimir-ivanov/observable-request-service-spec.ts
example of angular2 spec with MockBackend for the Http object - angular2 test
///<reference path="../../../typings/angularjs/angular-mocks.d.ts"/>
import {ObservableRequestService} from '../../../src/core/observable-request-service.ts';
import {
Http,
ConnectionBackend,
BaseRequestOptions,
MockBackend,
ResponseOptions,
Response
} from 'angular2/http';
@jbgraug
jbgraug / advices.txt
Created January 31, 2016 15:56 — forked from rponte/advices.txt
some ways to show sql generated by hibernate
Setting the hibernate.show_sql to true tells hibernate to Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL to debug.
So even if you set this property to false, make sure that you don't have the following category defined (or configured to use a console appender):
log4j.logger.org.hibernate.SQL=DEBUG
Also, make sure that you don't set the hibernate.show_sql programmatically to true when instancing your Configuration object. Hunt something like this:
Configuration cfg = new Configuration().configure().
.setProperty("hibernate.show_sql", "true");
Note that the setProperty(String propertyName, String value) takes as first parameter the full name of a configuration property i.e. hibernate.show_sql, not just show_sql.
@jbgraug
jbgraug / OkHttpStack.java
Created November 15, 2015 09:55 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is