Skip to content

Instantly share code, notes, and snippets.

View deepakazad's full-sized avatar

Deepak Azad deepakazad

View GitHub Profile
@deepakazad
deepakazad / app.js
Created May 13, 2016 21:50
Enable HTML5 mode in AngularJS - Client changes
app.config(function($locationProvider) {
$locationProvider.html5Mode({
enabled: true
});
});
@deepakazad
deepakazad / Gruntfile.js
Last active May 13, 2016 22:35
Enable HTML5 mode in AngularJS - Grunt changes
var modRewrite = require('connect-modrewrite'); //Make sure to declare this at top of the file
.
.
.
livereload: {
options: {
open: true,
middleware: function(connect) {
return [
@deepakazad
deepakazad / index.html
Created May 13, 2016 22:33
Detect JavaScript Support for Social Link Sharing
<html>
<head>
<title>Example | Your Custom Page Title</title>
<meta property="og:title" content="Example | Your Custom Page Title" />
<meta property="og:site_name" content="Example" />
<meta property="og:type" content="blog" />
<meta property="og:url" content="https://example.com/path/index.html" />
<meta property="og:description" content="Your Custom Page Description" />
<meta property="og:image" content="https://example.com/nice-image.jpg" />
@deepakazad
deepakazad / CompletableToSingle.java
Last active June 28, 2017 02:59
RxJava: Completable to Single
@Test
public void testCompletableToSingle() {
Completable.complete()
.toSingle(() -> Single.just("result"))
.test()
.assertValueCount(1)
.assertNoErrors();
}
@deepakazad
deepakazad / EmptyMaybeToSingle1.java
Created June 28, 2017 02:57
RxJava: Maybe To Single
@Test
public void testEmptyMaybeToSingle1() {
Maybe.empty()
.flatMapSingle(o -> Single.just("result"))
.test()
.assertError(NoSuchElementException.class);
}
@deepakazad
deepakazad / EmptyObservableToSingle.java
Last active June 28, 2017 03:37
RxJava: Observable to Single
@Test
public void testEmptyObservableToSingle() {
Observable.empty()
.flatMapSingle(o -> Single.just("result"))
.test()
.assertValueCount(0)
.assertNoErrors();
//Should there be an error?
}
@deepakazad
deepakazad / EmptyFlowableToSingle.java
Last active June 28, 2017 03:17
RxJava: Flowable to Single
@Test
public void testEmptyFlowableToSingle() {
Flowable.empty()
.flatMapSingle(o -> Single.just("result"))
.test()
.assertValueCount(0)
.assertNoErrors();
//There should have been an error
}
public final class RxJavaExceptionTesting {
public Observable<String> foo1() {
return Observable.empty();
}
public Observable<String> foo2() {
return Observable.error(new MyException());
}
public class RxJavaExceptionTestingTest {
private RxJavaExceptionTesting exceptionTesting;
@Before
public void initialize(){
exceptionTesting = new RxJavaExceptionTesting();
}
@Test
!definelong resource(relname, resourcename, type, descriptiontext, urltemplate)
<b>rel: </b>relname\n<b>resource: </b> resourcename : <i>type</i>\n<b>description: </b> descriptiontext\n<b>url: </b>urltemplate
!enddefinelong
!definelong resource(relname, resourcename, type, descriptiontext)
<b>rel: </b>relname\n<b>resource: </b> resourcename : <i>type</i>\n<b>description: </b> descriptiontext
!enddefinelong
!definelong resource(relname, resourcename, type)
<b>rel: </b>relname\n<b>resource: </b> resourcename : <i>type</i>