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 T To<T>(Endpoint endpoint) where T : Endpoint | |
{ | |
if (endpoint.GetType() == typeof(T)) | |
return endpoint as T; | |
var destination = Activator.CreateInstance<T>(); | |
destination.ApplicationId = endpoint.ApplicationId; | |
destination.TileId = endpoint.TileId; | |
destination.ClientId = endpoint.ClientId; |
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
namespace JsonToXml | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Xml; | |
using Newtonsoft; | |
using System.IO; |
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
$.getHashtagParam = function(paramToRetrieve: string): string { | |
var params = (document.URL.split("#")[1] || "").split("&"); | |
var paramsCount = params.length; | |
for (var paramIndex = 0; paramIndex < paramsCount; paramIndex = paramIndex + 1) { | |
var singleParam = params[paramIndex].split("="); | |
if (singleParam[0] === paramToRetrieve) { | |
return singleParam[1]; | |
} |
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 object of options to indicate where to post to | |
var post_options = { | |
host: 'api.mercadolibre.com', | |
port: '443', | |
path: util.format("/oauth/token?grant_type=authorization_code&client_id=%s&client_secret=%s&code=%s&redirect_uri=" + callbackUri, | |
config.clientId, config.clientSecret, encodeURIComponent(code)), | |
secureProtocol: 'SSLv3_method', | |
agent: false, | |
method: 'POST', | |
headers: { |
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
var securePassword = new System.Security.SecureString(); | |
foreach (char c in this.password) | |
{ | |
securePassword.AppendChar(c); | |
} | |
using (ClientContext ctx = new ClientContext(this.siteUrl) { Credentials = new SharePointOnlineCredentials(this.username, securePassword) }) | |
{ | |
Web w = ctx.Web; | |
List l = w.Lists.GetByTitle(CycloneTestConstants.WellKnownCycloneList); |
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
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
DECLARE @schema VARCHAR(128) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'U' AND category = 0 ORDER BY [name]) | |
SELECT @schema = (SELECT TOP 1 schema_name(schema_id) FROM sys.tables WHERE [name] = @name) | |
WHILE @name IS NOT NULL | |
BEGIN | |
SELECT @SQL = 'DROP TABLE [' + @schema + '].[' + RTRIM(@name) +']' |
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 reference see http://michaelwasham.com/windows-azure-powershell-reference-guide/copying-vhds-blobs-between-storage-accounts/ | |
Import-Module Azure | |
Set-AzureSubscription -SubscriptionName "Azure SDK Testing" -CurrentStorageAccount "portalvhdsq1x0n4q4zbfq5" | |
Select-AzureSubscription "Azure Store SDK Testing" | |
$destContext = New-AzureStorageContext –StorageAccountName "{destAccountName}" ` | |
-StorageAccountKey "{destAccountKey}" | |
$sourceContext = New-AzureStorageContext –StorageAccountName "{sourceAccountName}" ` |
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
Param( | |
[string]$filePath = $(throw "You must supply a file path") | |
) | |
clear | |
"--- Working... ---" | |
$filePath = Resolve-Path $filePath | |
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
var startDateUtcMilliseconds = "2324324823" // In C#: (buildRun.Date.ToUniversalTime() - new DateTime(1970, 1, 1)).TotalMilliseconds.ToString(); | |
var hours, minutes, seconds; | |
if (rowItem.currentBuild) { | |
var startDate = new Date(parseInt(startDateUtcMilliseconds)); | |
var msec = Date.now() - startDate; | |
hours = Math.floor(msec / 1000 / 60 / 60); // discard | |
msec -= hours * 1000 * 60 * 60; | |
minutes = Math.floor(msec / 1000 / 60); | |
msec -= minutes * 1000 * 60; |
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
// see https://help.github.com/articles/generating-ssh-keys | |
// Get fingerprint | |
ssh-keygen -l -f /path/to/keys/id_rsa.pub | |
// Generate key | |
ssh-keygen -t rsa -C "[email protected]" | |
ssh-add ~/.ssh/id_rsa |
OlderNewer