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 @myCounter int; | |
Set @myCounter = 1000; | |
WHILE (@myCounter > 0) | |
BEGIN | |
INSERT INTO [mytable].[dbo].[tickets] | |
([value]) | |
VALUES | |
(0) | |
Set @myCounter -= 1; |
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.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
namespace MyGenericHandler | |
{ | |
/// <summary> | |
/// Summary description for $codebehindclassname$ | |
/// </summary> |
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 arr = ["Anne", "Carl", "Benny"]; | |
arr.sort(desc); //returns "Carl","Benny","Anne" | |
arr.sort(asc); //returns "Anne","Benny","Carl" | |
alert(arr); | |
function desc(a, b) | |
{ | |
if(a.toLowerCase() > b.toLowerCase()){return -1;} | |
else {return 1;} |
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 request = function(value) | |
{ | |
var queryStr = location.href.split('?'); | |
if (queryStr.length < 2){ return ""; } | |
var requestObj = {}; | |
var level1 = []; | |
level1 = queryStr[1].split('&'); | |
for (var i = 0; i < level1.length; i++) { | |
level2 = level1[i].split('='); | |
requestObj[level2[0]] = level2[1]; |
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
//replace all whitespaces with underscore | |
string.replace(new RegExp(/\s/g), '_'); | |
//replace the word 'replace' with 'replaced' | |
string.replace(/replace/g, 'replaced'); |
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 a class person | |
class Person | |
{ | |
public string Name; | |
public Person(string name) | |
{ | |
this.Name = 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
jQuery.fn.extend({ | |
defaultInput: function() { | |
return $(this).each(function() { | |
$(this).addClass('default-text'); | |
var defaultText = $(this).val(); | |
$(this).focus(function() { | |
$(this).removeClass('default-text'); | |
if ($(this).val() == defaultText) { | |
$(this).val(""); | |
} |
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.Data; | |
using System.Data.SqlClient; | |
using System.Configuration; | |
var connectionStr = ConfigurationManager.ConnectionStrings["myconnection"].ConnectionString; | |
SqlCommand cmd = new SqlCommand(); | |
cmd.Connection = new SqlConnection(CONNECTIONSTR); | |
cmd.Parameters.Add(new SqlParameter("@name", name)); | |
cmd.Parameters.Add(new SqlParameter("@lastName", lastName)); | |
cmd.Parameters.Add(new SqlParameter("@date",DateTime.Now)); | |
cmd.Connection.Open(); |
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.Data; | |
using System.Data.SqlClient; | |
using System.Configuration; | |
var connectionStr = ConfigurationManager.ConnectionStrings["myconnection"].ConnectionString; | |
SqlCommand cmd = new SqlCommand(); | |
cmd.Connection = new SqlConnection(connectionStr); | |
cmd.Connection.Open(); | |
cmd.CommandText = "SELECT name, lastName FROM myTable"; | |
var users = new DataSet(); |