Skip to content

Instantly share code, notes, and snippets.

View davidsonsousa's full-sized avatar
🤓
Coding

Davidson Sousa davidsonsousa

🤓
Coding
View GitHub Profile
@davidsonsousa
davidsonsousa / partial_for_custom_video.cshtml
Created March 29, 2015 15:14
Partial view which sets a video according to the value passed by the model
@model Youtube_API_Custom_Video.Models.Video
<script>
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '@Model.Height',
width: '@Model.Width',
videoId: '@Model.Id'
});
@davidsonsousa
davidsonsousa / load_single_video.js
Last active August 29, 2015 14:16
Load a predefined video from youtube
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: 'jU5i1WjRBhE'
});
}
// Creates the script tag
var tag = document.createElement('script');
// Calls the API javascript
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
@davidsonsousa
davidsonsousa / bulk_insert_EF.cs
Last active August 29, 2015 14:13
Making Bulk Insert with Entity Framework
using (SqlConnection destinationConnection = new SqlConnection(connectionString))
{
destinationConnection.Open();
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection))
{
bulkCopy.DestinationTableName = "dbo.BulkCopyDemoMatchingColumns";
try
{
@davidsonsousa
davidsonsousa / project_name.wpp.targets
Created January 11, 2015 16:45
Example on how to create your <project_name>.wpp.targets to set folder permissions when using Web Deploy - davidsonsousa.net
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="SetupCustomAcls" AfterTargets="AddIisSettingAndFileContentsToSourceManifest">
<ItemGroup>
<MsDeploySourceManifest Include="setAcl">
<Path>$(_MSDeployDirPath_FullPath)\App_Data</Path>
<setAclAccess>Read,Write</setAclAccess>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>