Skip to content

Instantly share code, notes, and snippets.

View Phanatic's full-sized avatar
🤚
Building PostHog

Phani Raj Phanatic

🤚
Building PostHog
View GitHub Profile
> react-render-server@0.1.0 test /Users/phaniraj/Documents/github/ka/react-render-server
> mocha --reporter spec 'src/*_test.js'
warn: NOT LOGGING TO GRAPHITE: Error: ENOENT: no such file or directory, open '/Users/phaniraj/Documents/github/ka/react-render-server/hostedgraphite.api_key'.
warn: To log to hostedgraphite, create a file:
warn: /Users/phaniraj/Documents/github/ka/react-render-server/hostedgraphite.api_key
warn: Its contents should be hostedgraphite_api_key from webapp:secrets.py
fetchPackage
________ ___________ _____
\______ \ _______ _\_ _____/__ ___ / \ _____ ___.__.
| | \_/ __ \ \/ /| __)_\ \/ / / \ / \\__ \< | |
| ` \ ___/\ / | \> < / Y \/ __ \\___ |
/_______ /\___ >\_/ /_______ /__/\_ \ \____|__ (____ / ____|
\/ \/ \/ \/ \/ \/\/
_______________ ____ .________ ___________ __
\_____ \ _ \/_ || ____/ \_ _____/____ ____ ____ _/ |_ ____
/ ____/ /_\ \| ||____ \ | __) \__ \ _/ ___\/ __ \ \ __\/ _ \
/ \ \_/ \ |/ \ | \ / __ \\ \__\ ___/ | | ( <_> )
VERSION:
6.2.0-c9d4aaa
REQUEST: [2014-07-11T13:30:31-07:00]
GET /v2/spaces/68e1f79f-84c5-49ba-ad68-c289a7cf785b/apps?q=name%3Anode-app&inline-relations-depth=1 HTTP/1.1
Host: api.15.126.236.162.xip.io
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
@Phanatic
Phanatic / DataServiceAsyncExtensions.cs
Created August 22, 2012 16:32
Async extension methods for DataServiceContext
namespace System.Data.Services.Client.Async
{
using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using System.Threading.Tasks;
public static class DataServiceContextAsyncExtensions
{
public static async Task<IEnumerable<TResult>> ExecuteAsync<TResult>(this DataServiceQuery<TResult> query)
@Phanatic
Phanatic / DataServiceAsyncExtensions.cs
Created August 22, 2012 16:32
Async extension methods for DataServiceContext
namespace System.Data.Services.Client.Async
{
using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using System.Threading.Tasks;
public static class DataServiceContextAsyncExtensions
{
public static async Task<IEnumerable<TResult>> ExecuteAsync<TResult>(this DataServiceQuery<TResult> query)
@Phanatic
Phanatic / DataServiceExceptionUtil.cs
Created November 5, 2009 17:55
Ado.net Data Services : Efficient Error Handling across Application Tiers
/***************************
* Author : Phani Raj
* Blog : http://blogs.msdn.com/PhaniRaj
* * ************************/
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
/// <summary>
/// Executes the URI and loads the DataServiceCollection with the results of the request
/// </summary>
/// <typeparam name="TEntity">The entity type for the DataServiceCollection</typeparam>
/// <param name="context">The DataServiceContext instance that will be used
to query the DataService</param>
/// <param name="collection">The DataServiceCollection<paramref name="TEntity"/>
which will be loaded the the results of this query</param>
/// <param name="requestUri">The URI to query for data from the DataService</param>
public static void LoadDataServiceCollection<TEntity>(this DataServiceContext context,
//Create the DSC<Customers> instance with no initial data
var customersPagedCollection = DataServiceCollection.Create<Customers>();
//Fill the DataServiceCollection with initial data.
context.BeginExecute<Customers>(new Uri("/Customers"),
(asResult) =>{
Dispatcher.BeginInvoke(() =>{
var customersCollection = asResult.AsyncState as DataServiceCollection<Customers>;
try{
var customerQueryResponse = context.EndExecute<Customers>(asResult)
as QueryOperationResponse<Customers>;
//Page ahead if the NextLinkURI is not set to null
if (customersPagedCollection.NextLinkUri != null) {
customersPagedCollection.Load(
context.Execute<Customers>(customersPagedCollection.NextLinkUri)
);
}
1.1) Paging top level collections , ex: Paging /Customers.
1.1.1 ) Synchronous code :
//Create the DSC<Customers> instance with the initial data set to the result of a linq query
var customersPagedCollection = DataServiceCollection.Create<Customers>(
from cx in context.CreateQuery<Customers>("Customers")
select cx);