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 ApplicationUser : IdentityUser | |
{ | |
[Required] | |
public string FirstName { get; set; } | |
[Required] | |
public string LastName { get; set; } | |
[Required] | |
public string Email { get; set; } |
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
-- A table, "turtles": | |
CREATE TABLE turtles | |
( | |
id serial NOT NULL, | |
name text, | |
lastid integer, | |
CONSTRAINT pk_turtles PRIMARY KEY (id) | |
) | |
WITH ( | |
OIDS=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
INSERT INTO Transactions (Amount,Comment) | |
VALUES (@0,@1),(@2,@3),(@4,@5),(@6,@7),(@8,@9),(@10,@11),(@12,@13),(@14,@15),(@16,@17),(@18,@19) |
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
// LOGIN PARTIAL: | |
// Change the Views => Shared => _LoginPartial to match this: | |
@using Microsoft.AspNet.Identity | |
@if (Request.IsAuthenticated) | |
{ | |
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) | |
{ | |
@Html.AntiForgeryToken() |
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 OR REPLACE FUNCTION searchcustomers(text) RETURNS SETOF customers AS $$ | |
SELECT * FROM customers WHERE (last_name ILIKE $1 ||'%'); | |
$$ LANGUAGE SQL; | |
SELECT * FROM searchcustomers('GR') AS t1; |
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
var start = process.hrtime(); | |
var elapsed_time = function(note){ | |
var precision = 3; // 3 decimal places | |
var elapsed = process.hrtime(start)[1] / 1000000; // divide by a million to get nano to milli | |
console.log(process.hrtime(start)[0] + " s, " + elapsed.toFixed(precision) + " ms - " + note); // print message + time | |
start = process.hrtime(); // reset the timer | |
} | |
// Example: |
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
SELECT * FROM Information_schema.tables t | |
WHERE t.table_schema NOT In('information_schema', 'pg_catalog'); |
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
SELECT | |
tc.constraint_name key_name, | |
ctu.table_name parent_table, | |
tc.table_name child_table, | |
(SELECT kcu2.column_name | |
FROM information_schema.table_constraints tc2 | |
INNER JOIN information_schema.Key_column_usage kcu2 | |
ON tc2.table_name = kcu2.table_name AND tc2.constraint_name = kcu2.constraint_name | |
WHERE tc2.constraint_type = 'PRIMARY KEY' AND tc2.table_name = ctu.table_name) parent_id, | |
(SELECT kcu.column_name |
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
SELECT | |
ctu.table_name table_name, | |
ctu.constraint_name key_name, | |
ccu.column_name | |
FROM information_schema.table_constraints tc | |
INNER JOIN information_schema.constraint_table_usage ctu | |
ON ctu.constraint_name = tc.constraint_name | |
INNER JOIN information_schema.constraint_column_usage ccu | |
ON ccu.constraint_name = ctu.constraint_name | |
WHERE tc.constraint_type = 'PRIMARY KEY' |
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
SELECT | |
parent.table_name parent, | |
parent.constraint_name key_name, | |
tc.constraint_type key_type, | |
(SELECT c.table_name | |
FROM information_schema.table_constraints c | |
WHERE c.constraint_name = parent.constraint_name) child, | |
(SELECT pid.column_name | |
FROM information_schema.constraint_column_usage pid | |
WHERE pid.constraint_name = parent.constraint_name) pid, |