Skip to content

Instantly share code, notes, and snippets.

View tayyebi's full-sized avatar
📿
Grateful

MohammadReza Tayyebi tayyebi

📿
Grateful
View GitHub Profile
@tayyebi
tayyebi / ConnectionProperties.sql
Last active February 25, 2017 18:47
Get SQL Server connection properties
SELECT
CONNECTIONPROPERTY('net_transport') AS net_transport,
CONNECTIONPROPERTY('protocol_type') AS protocol_type,
CONNECTIONPROPERTY('auth_scheme') AS auth_scheme,
CONNECTIONPROPERTY('local_net_address') AS local_net_address,
CONNECTIONPROPERTY('local_tcp_port') AS local_tcp_port,
CONNECTIONPROPERTY('client_net_address') AS client_net_address
@tayyebi
tayyebi / MainActivity.cs
Last active February 25, 2017 20:54
Custom list adapter Xamarin.Android and direct SQL connection
using Android.App;
using Android.Widget;
using Android.OS;
using System.Data.SqlClient;
using System.Collections.Generic;
namespace MyAndroid
{
public class PostOnFirstPage
{
@tayyebi
tayyebi / RexaValidation.cs
Last active March 19, 2017 09:19
Validate any entity framework model from any .NET program
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Module2_Hamedan_MohammadRezaTayyebi.Components
@tayyebi
tayyebi / InstallDotNet (Run as admin).bat
Created March 5, 2017 12:44
Install .Net framework 3.5 on Windows using command line and Windows ISO sources
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:d:\sources\sxs
@tayyebi
tayyebi / mount_cdrom.sh
Created March 12, 2017 18:01
Mount cdrom Ubuntu
#!/bin/bash
sudo mkdir -p /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
@tayyebi
tayyebi / dpkg.sh
Created March 12, 2017 18:36
list package files and requirements to text file apt-get
#!/bin/bash
dpkg -i *.deb
@tayyebi
tayyebi / mvcaction.snippet
Created March 17, 2017 07:19
Agian you can have `mvcaction` in any version of Visual Studio
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>MVC Action</Title>
<Author>MohammadReza Tayyebi github.com/tayyebi</Author>
<Description>Creats an empty action</Description>
<Shortcut>mvcaction</Shortcut>
</Header>
@tayyebi
tayyebi / GordibuteAttribute.cs
Created March 23, 2017 08:03
Global authentication attribute for MVC
using System;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace Gordafarid.Controllers
{
internal class GordibuteAttribute : ActionFilterAttribute, IActionFilter
@tayyebi
tayyebi / fiddler-post.txt
Created March 23, 2017 14:32
send a post request form fiddler and receive it from asp.net mvc api
in fiddler composer:
Content-Type: application/x-www-form-urlencoded
and parameters in mvc api must be same as:
public void Post([FromBody]string password)
@tayyebi
tayyebi / tsqlexec.snippet
Created March 25, 2017 12:47
SQL Execute and SQL Read commands snippet for Visual Studio C#
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Transact SQL Execute</Title>
<Author>MohammadReza Tayyebi github.com/tayyebi</Author>
<Description>Creates SQL Execute</Description>
<Shortcut>tsqlexec</Shortcut>
</Header>