This file contains hidden or 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
convertDate: function (jsonDate) { | |
var someDate = new Date(+jsonDate.replace(/\/Date\((-?\d+)\)\//gi, "$1")); | |
return someDate; |
This file contains hidden or 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
data.sort( function(a, b) {return b.count - a.count} ); |
This file contains hidden or 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 int BinarySearch(int[] arr, int x) | |
{ | |
int i = 0; | |
int m = 0; | |
int j = arr.Length - 1; | |
while (i < j) | |
{ | |
m = ((i+j)/2); | |
if (x > arr[m]) | |
i = m + 1; |
This file contains hidden or 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 int LinearSearch(int[] arr, int x) | |
{ | |
int i = 0; | |
int location = 0; | |
int n = arr.Length -1; | |
while (i < n && arr[i] != x) | |
{ | |
i++; | |
} | |
if (i < n) |
This file contains hidden or 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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
var list = new int[] { 1, 5, 4, 8, 10, 2, 6, 9, 12, 11, 3, 7 }; | |
var a = InversionCounter(list, 0, 1, 0); | |
Console.WriteLine(a); | |
Console.ReadLine(); | |
} |
This file contains hidden or 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
void Main() | |
{ | |
var d1 = new Dictionary<string, int> | |
{ | |
{ "a" , 1 }, | |
{ "b" , 2 } | |
}; | |
var d2 = new Dictionary<string, int> | |
{ |
This file contains hidden or 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
def fib(n): | |
#display fib numbers from 0 to n | |
a, b = 0, 1 | |
while b < n: | |
print b, | |
a, b = b, a + b |
This file contains hidden or 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
SET XACT_ABORT ON | |
BEGIN TRY | |
BEGIN TRAN | |
--select * from vendor where vendorid = '37febdc9-a471-458c-b6b9-058ff69a85d3' | |
--select * from document | |
PRINT 'All statements executed, manually commit' | |
-- COMMIT |
This file contains hidden or 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
def GetMilk(): | |
if eggs: | |
return BuyMilk(6) | |
else: | |
return BuyMilk(1) |
This file contains hidden or 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
module Main where | |
import Control.Applicative | |
{- Result = (Mean = 0.34, St. Dev = 0.115, Variance = 0.005) -} | |
main :: IO () | |
main = interact stats | |
where | |
length' = fromIntegral . length | |
stats d = show (avg, stdDev, variance) |