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 string PrettyPrintArrayOfArrays(int[][] arrayOfArrays) | |
{ | |
if (arrayOfArrays == null) | |
return ""; | |
var prettyArrays = new string[arrayOfArrays.Length]; | |
for (int i = 0; i < arrayOfArrays.Length; i++) | |
{ | |
prettyArrays[i] = "[" + String.Join(",", arrayOfArrays[i]) + "]"; |
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
# delete all bin,obj,node_modules,bower_components,packages,.vs, and *proj.user files and directories | |
Get-ChildItem . -include bin -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | |
Get-ChildItem . -include obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | |
Get-ChildItem . -include node_modules -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | |
Get-ChildItem . -include bower_components -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | |
Get-ChildItem . -include packages -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | |
Get-ChildItem . -include .vs -Hidden -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } | |
Get-ChildItem . -include *proj.user -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } |
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
-- sp spaced used each table http://stackoverflow.com/a/7892361/47226 | |
-- must be temp table, table var not referenceable by SP | |
create table #TableSize ( | |
Name varchar(255), | |
[rows] int, | |
reserved varchar(255), | |
data varchar(255), | |
index_size varchar(255), | |
unused varchar(255)) |
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
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Redirect_to_https" stopProcessing="true"> | |
<match url="(.*)" /> | |
<conditions> | |
<add input="{HTTPS}" pattern="off" ignoreCase="true" /> | |
<add input="{HTTP_HOST}" pattern="localhost" negate="true" ignoreCase="true" /> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> |
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
// The using below is needed for "UsersContext" - it will be relative to your project namespace | |
using MvcApplication1.Models; | |
using System; | |
using System.Data.Entity; | |
using System.Data.Entity.Infrastructure; | |
using System.Threading; | |
using System.Web.Http; | |
using System.Web.Mvc; | |
using System.Web.Optimization; |
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
-- query to generate a query for each column that gathers metadata about that column based on its data type | |
declare @table_name varchar(200) = 'dbo.tablename' | |
-- queries for individual rows | |
select | |
c.name [column_name] | |
,c.system_type_id | |
,c.max_length | |
,c.is_identity | |
,c.is_nullable |
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
CREATE DATABASE [OpmFedScope] | |
CONTAINMENT = NONE | |
ON PRIMARY | |
( NAME = N'OpmFedScope', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\OpmFedScope.mdf' , SIZE = 134144KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) | |
LOG ON | |
( NAME = N'OpmFedScope_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\OpmFedScope_log.ldf' , SIZE = 15040KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) | |
GO | |
ALTER DATABASE [OpmFedScope] SET COMPATIBILITY_LEVEL = 120 | |
GO | |
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) |
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 class SpotifyApiController | |
{ | |
//see https://developer.spotify.com/web-api/authorization-guide/#client_credentials_flow | |
public void GetClientCredentialsAuthToken() | |
{ | |
var spotifyClient = ""; | |
var spotifySecret = ""; | |
var webClient = new WebClient(); | |
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 ActionResult StartOAuth() | |
{ | |
var redditOAuthAuthorizeUri = "https://www.reddit.com/api/v1/authorize"; | |
var redditOAuthRedirectUri = "https://localhost:44399/RedditRedirectUri"; // your redirect uri | |
var redditOAuthScopes = ""; // ex: "identity,history" scope param https://github.com/reddit/reddit/wiki/OAuth2#authorization | |
var redditClientId = ""; // from app: https://www.reddit.com/prefs/apps | |
var oauthState = Guid.NewGuid(); // used to uniquely identify this request | |
// todo: store oauthState somewhere... | |
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
Rank | CityName | StateName | StateCode | Population | Latitude | Longitude | GeonamePopulation | GeonameId | |
---|---|---|---|---|---|---|---|---|---|
1 | New York | New York | NY | 8550405 | 40.71427 | -74.00597 | 8175133 | 5128581 | |
2 | Los Angeles | California | CA | 3971883 | 34.05223 | -118.24368 | 3792621 | 5368361 | |
3 | Chicago | Illinois | IL | 2720546 | 41.85003 | -87.65005 | 2695598 | 4887398 | |
4 | Houston | Texas | TX | 2296224 | 29.76328 | -95.36327 | 2099451 | 4699066 | |
5 | Philadelphia | Pennsylvania | PA | 1567442 | 39.95233 | -75.16379 | 1526006 | 4560349 | |
6 | Phoenix | Arizona | AZ | 1563025 | 33.44838 | -112.07404 | 1445632 | 5308655 | |
7 | San Antonio | Texas | TX | 1469845 | 29.42412 | -98.49363 | 1327407 | 4726206 | |
8 | San Diego | California | CA | 1394928 | 32.71533 | -117.15726 | 1307402 | 5391811 | |
9 | Dallas | Texas | TX | 1300092 | 32.78306 | -96.80667 | 1197816 | 4684888 |