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
// This code gets all textboxes with the 'required' class and | |
// executes a method for those that don't have a value. | |
$(":text .required" ).each(function( index, element ) { | |
var self = this; | |
var labelText = $('label[for=' + self.id + ']').text(); | |
if (element.val() == "") { | |
message("Please fill " + labelText, "#" + self.id); | |
return 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
declare @NotesXml xml = | |
'<root> | |
<Notes CreationDate="01/18/2015" Note="Note 1" UserID="10"/> | |
<Notes CreationDate="01/18/2015" Note="Note 2" UserID="20"/> | |
</root>' | |
declare @notesTable as table ( | |
CreationDate datetime, | |
Note varchar(max), | |
UserID int |
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 TABLE [Clients] | |
( | |
ClientID int NOT NULL IDENTITY(1,1) CONSTRAINT [PK_Clients] PRIMARY KEY, | |
ServiceCode varchar(50) NOT NULL, | |
CONSTRAINT [UN_Clients_Unique] UNIQUE (ClientID, ServiceCode) | |
... | |
) |
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
<pre class="brush:js; toolbar:false; auto-links:false;"> | |
$.ajax({ | |
url: "/Home/Index", | |
data: { email: email, username: username, etc: etc }, | |
success: function (data) { | |
debugger; // remove debugger before check-in. | |
$("#somelabel").text(data.SomeText); | |
}, | |
type: "POST", | |
dataType: 'json' |
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
int myData = 20; | |
if(IsInTable(tableName: "A", data: myData)) { | |
print("data found in table A"); | |
} | |
else if (IsInTable(tableName: "B", data: myData)) { | |
print("data found in table B"); | |
} | |
else if (IsInTable(tableName: "C", data: myData)) { | |
print("data found in table C"); |
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
int n = 15; | |
for (int i = 1; i < n; i++) { | |
var button = GetButton(i); | |
buttton.Image = new Bitmap(@"..\..\Resources\DateButtons\" + buttton.Tag + ".png"); | |
} | |
private Button GetButton(int number) { | |
// this code gets and returns the button especified by number from its container. | |
} |
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
declare @today datetime | |
set @today = CAST(convert(varchar, GETDATE(), 101) as datetime) | |
select | |
j.name as job_name, | |
run_datetime = CONVERT(DATETIME, RTRIM(run_date)) + | |
(run_time * 9 + run_time % 10000 * 6 + run_time % 100 * 10) / 216e4, | |
run_duration = RIGHT('000000' + CONVERT(varchar(6), run_duration), 6), * | |
from msdb..sysjobhistory h | |
inner join msdb..sysjobs j |
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
// This: | |
item.PickupId = (item.PickupId == null) ? headerRecord.PickupId : item.PickupId; | |
// Is the same as this: | |
if(item.PickupId == null) { | |
item.PickupId = headerRecord.PickupId | |
} else { |
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
# Open IIS from command line | |
C:\Windows\system32>cd inetsrv | |
C:\Windows\System32\inetsrv>%systemroot%\system32\inetsrv\iis.msc | |
# Start and stop application pool | |
C:\Windows\System32\inetsrv>appcmd stop apppool /apppool.name:lorem-ipsum | |
"lorem-ipsum" successfully stopped | |
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
// Evil if: | |
if (x == 1) { | |
if (x == 1.1) { | |
print("lorem ipsum 1.1") | |
} | |
else if (x == 1.2) { | |
print ("lorem ipsum 1.2") | |
} | |
else if (x == 1.3) { |
OlderNewer