This file contains hidden or 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 void AttachToOrGet<T>(this ObjectContext context, string entitySetName, ref T entity) | |
where T : IEntityWithKey | |
{ | |
ObjectStateEntry entry; | |
// Track whether we need to perform an attach | |
bool attach = false; | |
if ( | |
context.ObjectStateManager.TryGetObjectStateEntry | |
( | |
context.CreateEntityKey(entitySetName, entity), |
This file contains hidden or 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
<!-- before... --> | |
<img src="/images/logo.png" /> | |
<!-- ...after --> | |
<img src="data: image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPAAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoKDBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8fHx8fHx8fHx8fHx8fH ...." /> | |
<-- live example at: http://davidwalsh.name/demo/data-uri-php.php --> |
This file contains hidden or 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
byte[] buffer = Encoding.UTF8.GetBytes(text); | |
var ms = new MemoryStream(); | |
using (var zip = new GZipStream(ms, CompressionMode.Compress, true)) | |
{ | |
zip.Write(buffer, 0, buffer.Length); | |
} | |
ms.Position = 0; | |
var compressed = new byte[ms.Length]; | |
ms.Read(compressed, 0, compressed.Length); |
This file contains hidden or 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
<div> | |
<div class="navbar navbar-fixed-top"> | |
<div class="navbar-inner"> | |
<ul class="nav" data-bind="foreach: router.navigationModel"> | |
<li data-bind="css: { active: isActive }"> | |
<a data-bind="attr: { href: hash }, html: title"></a> | |
</li> | |
</ul> | |
</div> | |
</div> |
This file contains hidden or 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
define(['plugins/router', 'durandal/app'], function (router, app) { | |
return { | |
router: router, | |
activate: function () { | |
router.map([ | |
{ route: '', title:'Welcome', moduleId: 'viewmodels/welcome', nav: true }, | |
{ route: 'flickr', moduleId: 'viewmodels/flickr', nav: true } | |
]).buildNavigationModel(); | |
return router.activate(); |
This file contains hidden or 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
requirejs.config({ | |
paths: { | |
'text': '../Scripts/text', | |
'durandal': '../Scripts/durandal', | |
'plugins': '../Scripts/durandal/plugins', | |
'transitions': '../Scripts/durandal/transitions' | |
} | |
}); | |
define('jquery', function () { return jQuery; }); |
This file contains hidden or 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
<body> | |
<div id="applicationHost"></div> | |
<script type="text/javascript" src="/Scripts/require.js" data-main="/App/main"></script> | |
</body> |
This file contains hidden or 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
base64Keys = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="; | |
base64Encode = function (input) { | |
var chr1, chr2, chr3, enc1, enc2, enc3, enc4, i, output; | |
output = ""; | |
i = 0; | |
input = utf8Encode(input); | |
while (i < input.length) { | |
chr1 = input.charCodeAt(i++); | |
chr2 = input.charCodeAt(i++); | |
chr3 = input.charCodeAt(i++); |
This file contains hidden or 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 @Filename varchar(100) | |
SET @Filename = N'D:\Google Drive\ShelegBackups\IceHouce\IceHouseDB_' +convert(varchar, GetDate(), 102) + '.bak' | |
BACKUP DATABASE [IceHouseDB] TO DISK = @Filename WITH NOFORMAT, | |
INIT, NAME = N'IceHouseDB-Full Database Backup', SKIP, | |
NOREWIND, NOUNLOAD, STATS = 10 | |
declare @backupSetId as int | |
select @backupSetId = position from msdb..backupset _ | |
where database_name=N'IceHouseDB' and backup_set_id=(select max(backup_set_id) | |
from msdb..backupset where database_name=N'IceHouseDB' ) |
This file contains hidden or 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.Web; | |
using System.ComponentModel; | |
public static class EventBroker | |
{ | |
private static object EventsKey = new object(); | |
public static void Subscribe<TType>(this HttpContextBase source, object key, EventHandler<TType> value) | |
where TType : EventArgs |
NewerOlder