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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 CASE PS.database_id | |
WHEN 32767 | |
THEN 'Resource DB' | |
ELSE DB_NAME(PS.database_id) | |
END AS [DB Name] | |
,OBJECT_NAME(PS.object_id, PS.database_id) AS [SP Name] | |
,PS.last_execution_time AS [Last Executed] | |
,PS.execution_count AS [# runs] | |
FROM sys.dm_exec_procedure_stats PS | |
ORDER BY DB_NAME(PS.database_id) |
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 t.NAME AS table_name | |
,SCHEMA_NAME(schema_id) AS schema_name | |
,c.NAME AS column_name | |
FROM sys.tables AS t | |
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID | |
WHERE c.NAME LIKE '%EmployeeID%' | |
ORDER BY schema_name | |
,table_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
INSERT INTO TargetTable ( | |
id | |
,NAME | |
) | |
SELECT id | |
,NAME | |
FROM SourceTable AS S | |
WHERE NOT EXISTS ( |
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
-- sử dụng bản gốc | |
UPDATE TargetTable | |
SET | |
Name = 'XXX' | |
FROM | |
TargetTable parentTable | |
INNER JOIN TargetTable | |
ON | |
parentTable.id = TargetTable.parent_id | |
WHERE |
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
// Source: https://gist.github.com/luetkemj/2023628 | |
// Xem hướng dẫn WP_Query toàn tập: http://goo.gl/kRpzTz | |
<?php | |
$args = array( | |
//////Author Parameters - Tham số lấy bài viết theo tác giả | |
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters | |
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20) | |
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả | |
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả |
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 code below will embed replace [gist id=x] tags with an embedded gist similar to the way the Wordpress Gist | |
//plugin works. I wrote this in order to import posts from Wordpress. See //GB: for the changes. | |
// **takes:** filter / pagination parameters | |
browse: function browse(options) { | |
options = options || {}; | |
// **returns:** a promise for a page of posts in a json object | |
//return dataProvider.Post.findPage(options); | |
return dataProvider.Post.findPage(options).then(function (result) { |
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 ConnectionFactory { | |
public static DbConnection GetOpenConnection() { | |
var connection = new SqlConnection("MyConnectionString"); | |
connection.Open(); | |
return connection; | |
} | |
} |
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
using System; | |
using System.Web.Mvc; | |
using EPiServer.Shell.ObjectEditing; | |
using Mediachase.BusinessFoundation.Data.Meta.Management; | |
/// <summary> | |
/// The meta enum selection attribute. | |
/// </summary> |
OlderNewer