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
// User Language | |
var language = getLanguage(); | |
function getLanguage() { | |
var lang = ''; | |
if (navigator.userLanguage) { | |
lang = navigator.userLanguage; | |
} | |
else if (navigator.language) { | |
lang = navigator.language; |
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 static class ValueInjecter | |
{ | |
public static void CopyPropertiesTo<T, TU>(this T source, TU dest) { | |
var sourceProps = typeof(T).GetProperties().Where(x => x.CanRead).ToList(); | |
var destProps = typeof(TU).GetProperties() | |
.Where(x => x.CanWrite) | |
.ToList(); | |
foreach (var sourceProp in sourceProps) { | |
if (destProps.Any(x => x.Name == sourceProp.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
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN | |
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
EXEC (@SQL) |
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_MSForEachTable 'DECLARE @t AS VARCHAR(MAX); | |
SELECT @t = CAST(COUNT(1) as VARCHAR(MAX)) | |
+ CHAR(9) + CHAR(9) + ''?'' FROM ? ; PRINT @t' |
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
EXEC sp_MSForEachTable 'DISABLE TRIGGER ALL ON ?' | |
GO | |
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' | |
GO | |
EXEC sp_MSForEachTable 'DELETE FROM ?' | |
GO | |
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL' | |
GO | |
EXEC sp_MSForEachTable 'ENABLE TRIGGER ALL ON ?' | |
GO |
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 d.name, | |
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs | |
FROM sys.master_files mf | |
INNER JOIN sys.databases d ON d.database_id = mf.database_id | |
WHERE d.database_id > 4 -- Skip system databases | |
GROUP BY d.name | |
ORDER BY d.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
from math import sin, cos, radians | |
import sys | |
def make_dot_string(x): | |
return ' '*int(10*cos(radians(x))+10) + 'o' | |
assert make_dot_string(90) == ' o' | |
assert make_dot_string(180) == 'o' | |
def main(): |
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
static bool IsNumeric(object Expression) | |
{ | |
bool isNum; | |
double retNum; | |
isNum = Double.TryParse(Convert.ToString(Expression), System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum ); | |
return isNum; | |
} |
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 FUNCTION [dbo].[fn_SplitText] | |
( | |
@RowData NVARCHAR(MAX), | |
@Delimeter NVARCHAR(MAX) | |
) | |
RETURNS @RtnValue TABLE | |
( | |
ID INT IDENTITY(1,1), | |
Data NVARCHAR(MAX) | |
) |
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
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN | |
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
EXEC (@SQL) |
NewerOlder