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 class TrackingService | |
{ | |
// Sample usage: | |
// service.TrackEvent("customers/add"); | |
// service.TrackEvent("order/discount-applied"); | |
public void TrackEvent(string path) | |
{ | |
ThreadPool.QueueUserWorkItem(x => TrackPageView("/events/" + path)); | |
} |
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 void UpdateStatus(string message) | |
{ | |
// Application tokens | |
const string CONSUMER_KEY = "YOUR_CONSUMER_KEY"; | |
const string CONSUMER_SECRET = "YOUR_CONSUMER_SECRET"; | |
// Access tokens | |
const string ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"; | |
const string ACCESS_TOKEN_SECRET = "YOUR_ACCESS_TOKEN_SECRET"; | |
// Common parameters |
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
// Related code: https://gist.github.com/2905028 | |
public IEnumerable<string> GetTimeline(int count) | |
{ | |
// Application tokens | |
const string CONSUMER_KEY = "YOUR_CONSUMER_KEY"; | |
const string CONSUMER_SECRET = "YOUR_CONSUMER_SECRET"; | |
// Access tokens | |
const string ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"; | |
const string ACCESS_TOKEN_SECRET = "YOUR_ACCESS_TOKEN_SECRET"; |
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 koalite.cordova; | |
import org.apache.cordova.api.Plugin; | |
import org.apache.cordova.api.PluginResult; | |
import org.apache.cordova.api.PluginResult.Status; | |
import org.json.JSONArray; | |
import android.content.Intent; | |
import android.net.Uri; | |
public class GoToPlugin extends Plugin { |
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
// Required libs | |
// - NUnit | |
// - Castle.DynamicProxy | |
using System; | |
using System.Linq; | |
using System.Reflection; | |
using Castle.DynamicProxy; | |
using NUnit.Framework; |
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
// Required libs | |
// - NUnit | |
// - Castle.DynamicProxy | |
using System; | |
using System.Linq; | |
using System.Reflection; | |
using Castle.DynamicProxy; | |
using NUnit.Framework; |
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 struct Id<T> | |
{ | |
public readonly int Value; | |
public Id(int value) | |
{ | |
this.value = value; | |
} | |
public static implicit operator Id<T>(int value) |
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
// Situación inicial | |
public class OrderStatsCalculator | |
{ | |
// Inyectado por constructor. En todos los casos lo hago igual. | |
private IOrderRepository repository; | |
// Esto se puede testear con un mock/stub/fake/etc. que inyectes por | |
// el constructor | |
public int Calculate() | |
{ |
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 interface IElement | |
{ | |
IEnumerable<ChildElement> Children { get; } | |
} | |
public class ChildElement | |
{ | |
public readonly IElement Value; | |
public readonly Point Point; | |
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 static class Extensions | |
{ | |
public IDictionary<string, object> AsDict(this object obj) | |
{ | |
return obj.GetType().GetProperties().ToDictionary(x => x.Name, x => x.GetValue(obj, null)) | |
} | |
} | |
var obj = new { Name = "Lucas", Age = 14 }.AsDict(); |
OlderNewer