Skip to content

Instantly share code, notes, and snippets.

@cdm
cdm / ViewModelExtensions.cs
Created March 27, 2016 07:04
ViewModel Extensions for Xamarin
using System;
namespace FooBar.Extensions
{
public static class ViewModelExtensions
{
#region Static Methods
public static string GetExceptionMessage(this Exception exception)
{
@cdm
cdm / .gitignore
Created May 9, 2016 05:48
GitIgnore file used by the folks at Xamarin Inc
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
*.userprefs
# ignore Xamarin.Android Resource.Designer.cs files
<!-- Put this inside App.xaml -->
<!-- if you don't know how to add App.xaml to your project use this guide: http://goo.gl/GuXMDD/>
<!-- Some default style resets -->
<Style TargetType="Grid">
<Setter Property="Padding"
Value="0" />
<Setter Property="RowSpacing"
Value="0" />
<Setter Property="ColumnSpacing"
@cdm
cdm / gist:bce25582f796c96236c3625adbcba36f
Created February 9, 2017 10:24
React-Native Default Fonts
To use in react-native, choose from font below, and then add to style element:
<Text style={{ fontFamily: 'Arial' }}>Arial Font</Text>
Alternatively, add your own custom font face
Android:
========
normal
@cdm
cdm / GridExtensions.cs
Created May 15, 2017 09:58
Xamarin Forms GridExtensions
using System;
using Xamarin.Forms;
namespace cdm.xamarin.forms
{
/// <summary>
/// Easily add grid rows and columns with this extension class
/// </summary>
public static class GridExtensions
{
public static class DateTimeHelper
{
private static readonly DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Return the number of seconds since Epoch (1st Jan 1970)
/// </summary>
/// <returns>Seconds since epoch</returns>
public static long SecondsSinceEpoch()
{
@cdm
cdm / authenticator.cs
Created June 6, 2017 09:23
Echo request/response in HttpMessageHandler
#if DEBUG
Debug.WriteLine("Request:");
Debug.WriteLine(request.ToString());
if (request.Content != null)
{
var bytes = await request.Content.ReadAsByteArrayAsync();
Debug.WriteLine(bytes.Length);
Debug.WriteLine(Encoding.UTF8.GetString(bytes, 0, bytes.Length));
Debug.WriteLine(await request.Content.ReadAsStringAsync());
import requests
import pandas
print("Loading $VEGA historic daily price data from CoinGecko API")
url = "https://api.coingecko.com/api/v3/coins/vega-protocol/market_chart?vs_currency=usd&days=max&interval=daily"
response = requests.get(url)
response_json = response.json()
dict = {
#!/usr/bin/python3
import os
import requests
# ACCOUNT TYPES (DO NOT EDIT)
account_type_taker_fees = "ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES" # Per asset reward account for fees paid by takers
account_type_maker_fees = "ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES" # Per asset reward account for fees received by makers
account_type_lp_fees = "ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES" # Per asset reward account for fees received by liquidity providers
account_type_market_proposers = "ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS" # Per asset reward account for market proposers when the market goes above a trading threshold
#!/usr/bin/python3
import os
import requests
transfer_id = "fa1a3ceb74b6b8b1525f44bf688569bcd8d7ca74a93cbcbbd8012001094e0a95"
node_url_rest = os.getenv("NODE_URL_REST")
wallet_server_url = os.getenv("WALLETSERVER_URL")
wallet_name = os.getenv("WALLET_NAME")
wallet_passphrase = os.getenv("WALLET_PASSPHRASE")