This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Utilizes a source observable to trigger several requests to fetch images. | |
* Requests are then tagged with cancellation tokens so that they can be cancelled at will. | |
* The flatmap operator and it's max concurrency parameter is utilized to restrict | |
* the app to 4 requests. | |
* Several other transformations are done before the results are propagated to the list adapter. | |
* | |
* @param values | |
*/ | |
private void fetchNumbersFromApi(Observable<Number> values) { | |
DisposableManager.add( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task ConfigSendGridasync(IdentityMessage message) | |
{ | |
ServicePointManager.Expect100Continue = true; | |
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; | |
var myMessage = new SendGridMessage(); | |
var result = PreMailer.Net.PreMailer.MoveCssInline(message.Body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<LeaderboardModel> GetHighScores(Guid userId) | |
{ | |
//This query sorts the users based on their scores. | |
var userScores = Context.Users.Select(user => new UserScoreModel | |
{ | |
Points = user.UserPoints.Sum(p => p.Point.Value), | |
Country = user.Country, | |
FacebookId = user.FacebookUserId, | |
Name = user.FirstName + " " + user.LastName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This query sorts the users baised on their scores. | |
var userScores = Context.Users.Select(user => new UserScoreModel { | |
Points = user.UserPoints.Where(p => (p.AwardedOn - DateTime.UtcNow).Days < 7).Sum(p => p.Point.Value), | |
Country = user.Country, | |
FacebookId = user.FacebookUserId, | |
Name = user.FirstName + " " + user.LastName, | |
}) | |
.OrderByDescending(user => user.Points) | |
.Select((userScoreModel, rank)=> new UserScoreModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
apply plugin: 'android-apt' | |
apply plugin: 'com.getkeepsafe.dexcount' | |
android { | |
compileSdkVersion 23 | |
buildToolsVersion "23.0.1" | |
defaultConfig { | |
applicationId "com.mentor" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"message": "An error has occurred.", | |
"exceptionMessage": "Object reference not set to an instance of an object.", | |
"exceptionType": "System.NullReferenceException", | |
"stackTrace": " at WakeSocial.Gateway.WebApi.Host.Controllers.NotificationsController.<>c.<Get>b__4_0(Notification notification)\r\n | |
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()\r\n at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n | |
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()\r\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n at WakeSocial.Gateway.WebApi.Host.Controllers.NotificationsController.<Get>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task tas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2009 Google Inc. | |
// Copyright 2011 NPR | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private MediaPlayer player1; | |
private MediaPlayer player2; | |
CyclicBarrier cyclicBarrier; | |
... | |
//two represents number of thread that will wait until they are all loaded. | |
cyclicBarrier = new CyclicBarrier(2); | |
player1.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application | |
android:allowBackup="true" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" | |
android:theme="@style/Theme.Map" > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wake.friend.utils; | |
import android.content.Context; | |
import android.graphics.*; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/** |