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
using System; | |
using System.Reflection; | |
namespace SharpSerializer | |
{ | |
public static class ExtensionMethods | |
{ | |
public static PropertyInfo GetProperty(this Type type, String propertyName) | |
{ | |
return type.GetTypeInfo().GetDeclaredProperty(propertyName); |
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
// An implementation of IPortableTask which wraps an actual Task. | |
// This has to go in a project targeting a platform or platforms which support Task and async/await | |
using System; | |
using System.Threading.Tasks; | |
namespace PortableTasks | |
{ | |
public class AsyncPortableTask : IPortableTask | |
{ |
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
// For returning objects | |
public class PagedResult<T> { | |
public List<T> Items { get; set; } | |
public long CurrentPage { get; set; } | |
public long ItemsPerPage { get; set; } | |
public long TotalItems { get; set; } | |
public long TotalPages { get; set; } | |
public string Text { get; set; } | |
public int ItemsDisplayed { get; set; } |
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
import RPi.GPIO as GPIO | |
import time | |
import traceback | |
# Helper | |
def bin2dec(string_num): | |
return str(int(string_num, 2)) | |
def setup_gpio(port): | |
GPIO.setmode(GPIO.BCM) |
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
# -*- coding: utf-8 -*- | |
#!/usr/bin/python | |
import subprocess | |
import os | |
import picamera | |
import time | |
import shlex | |
from datetime import datetime | |
from datetime import timedelta | |
import datetime as dt |
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
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %> | |
<dnn:DnnCssExclude runat="server" Name="dnndefault" /> |
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 List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null) | |
{ | |
using (db.Connection.EnsureOpen()) | |
{ | |
try | |
{ | |
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList(); | |
} | |
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906)) | |
{ |
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
using System; | |
using System.Data; | |
using System.Data.Sql; | |
using System.Data.SqlClient; | |
using System.Configuration; | |
using DotNetNuke.Services.Mail; | |
using DotNetNuke.Entities.Portals; | |
using DotNetNuke.Common.Utilities; | |
using DotNetNuke.Entities.Portals; |
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
using System; | |
using System.Globalization; | |
using System.Text.RegularExpressions; | |
using Xamarin.Forms; | |
namespace MyProject.Util | |
{ | |
/// <summary> | |
/// Converter for using in Entry fields for masked input of currency. | |
/// <para>The binded property must be of type decimal, and must invoke the PropertyChangedEventArgs event whenever the value is changed, so that the desired mask behavior is kept.</para> |
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<string> DoCurlAsync() | |
{ | |
using (var httpClient = new HttpClient()) | |
using (var httpResonse = await httpClient.GetAsync("https://www.bynder.com")) | |
{ | |
return await httpResonse.Content.ReadAsStringAsync(); | |
} | |
} |
OlderNewer