Skip to content

Instantly share code, notes, and snippets.

View dabblet.html
<!--ash-->
<div class="speech-bubble">ash</div>
View dabblet.css
/*final-css*/
.speech-bubble {
text-align:center;
font:40px/100px Arial, sans-serif;
color:#fff;
background:red;
width:300px;
height:100px;
margin:auto;
position: absolute;
View ExecuteSqlTransaction
private static void ExecuteSqlTransaction(string connectionString)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = connection.CreateCommand();
SqlTransaction transaction;
View ExecuteTwoMethodsOpeningTwoConnections
private static void ExecuteTwoMethodsOpeningTwoConnections(string connectionString)
{
using(TransactionScope scope = new TransactionScope())
{
ExecuteCommandA(connectionString);
ExecuteCommandB(connectionString);
Console.WriteLine("Both records are written to database transactionally.");
scope.Complete();
}
View ExecuteSqlTransactionUsingTransactionScope
private static void ExecuteSqlTransactionUsingTransactionScope(string connectionString)
{
using(TransactionScope scope = new TransactionScope())
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = connection.CreateCommand();
View transfer_data_between_azure_storage_accounts
## Transfer data in Azure Storage Tables from one Azure Storage Account to another
## Download and install AzCopy -- https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/
## Get the Preview version of AzCopy in order to access Table Storage. The current stable version works with Blob storage only.
## Tables will be created if they don't exist
$source_acct = "Source_Azure_Storage_Account_Name"
$source_key="Source_Azure_Storage_Account_Key"
$destination_acct="Destination_Azure_Storage_Account_Name"
$destination_key="Destination_Azure_Storage_Account_Key"
@ashtewari
ashtewari / gist:5091144
Created Mar 5, 2013
Unit test fails because TimeZoneInfo does not use the correct DST transitions.
View gist:5091144
/// <summary>
/// Is the specified datetime DST?
/// </summary>
[TestMethod]
public void DST_Started_On_April_27_1980()
{
var ts = new DateTime(1980, 4, 15, 12, 0, 0);
var isDst = Utils.EasternTimeZone.IsDaylightSavingTime(ts);
View list-of-datetimeoffset-columns
/* List all columns in the current database that are of datetimeoffset datatype */
Use $(DbName)
go
SELECT c.Object_ID
, OBJECT_NAME(c.OBJECT_ID) TableName
,c.name AS ColumnName
,SCHEMA_NAME(t.schema_id) AS SchemaName
@ashtewari
ashtewari / TestSignedXml.js
Last active Dec 20, 2015
nodeunit unit test for validating xml-crypto generated signed xml.
View TestSignedXml.js
var testrunner = require('nodeunit').reporters.default;
process.chdir(__dirname);
testrunner.run(['.']);
exports.testSignedXml = function(test){
var SignedXml = require('xml-crypto').SignedXml
, fs = require('fs')
, dom = require('xmldom').DOMParser;
View dabblet.css
/*final-css*/
.speech-bubble {
text-align:center;
font:40px/100px Arial, sans-serif;
color:#fff;
background:red;
width:300px;
height:100px;
margin:auto;
position: absolute;