Skip to content

Instantly share code, notes, and snippets.

@cflove
cflove / sql-test.sql
Last active August 29, 2015 14:01
sql-test
--CREATE TABLE #MyTable (EventNname varchar(20), EventDate date, PublishedDate date)
INSERT INTO #MyTable
SELECT 'Bake Sale', '1/1/2014','1/1/2014' UNION ALL
SELECT 'Movie Night', '1/2/2014','1/2/2014' UNION ALL
SELECT 'Dance Night', '1/3/2014','1/2/2014' UNION ALL
SELECT 'Flea Market', '1/4/2014','1/3/2014' UNION ALL
SELECT 'Dance Night', '1/5/2014','1/3/2014' UNION ALL
SELECT 'Marathon', '1/6/2014','1/3/2014' UNION ALL
SELECT 'Daance', '1/3/2014','1/2/2014'
@cflove
cflove / sql3.sql
Last active August 29, 2015 14:00
sql-3
SELECT AVG(ListPrice) , MIN(ListPrice), max(ListPrice),
sum(ListPrice), count(ListPrice), COUNT_BIG(ListPrice), color
FROM Production.Product
group by color
SELECT AVG(ListPrice) , MIN(ListPrice), max(ListPrice),
sum(ListPrice), count(ListPrice) as c, COUNT_BIG(ListPrice), color
FROM Production.Product
group by color
*******************************************************************
-- INLINE CALCULATIONS
SELECT VacationHours + SickLeaveHours as daysOff, JobTitle,VacationHours, SickLeaveHours
FROM [AdventureWorks2012].[HumanResources].[Employee]
SELECT [CommissionPct] ,[SalesYTD], ([SalesYTD]/100)*[CommissionPct] as commission
FROM [AdventureWorks2012].[Sales].[SalesPerson]
SELECT [JobTitle]
FROM [AdventureWorks2012].[HumanResources].[Employee]
SELECT DISTINCT [JobTitle], Gender
FROM [AdventureWorks2012].[HumanResources].[Employee]
SELECT VacationHours + SickLeaveHours as daysOff, JobTitle,VacationHours, SickLeaveHours
FROM [AdventureWorks2012].[HumanResources].[Employee]
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<style type="text/css">
.dragging {background-color: blue}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<style type="text/css" media="screen">
.box {background-color: red; width: 80px; height: 80px; display: inline-block;}
</style>
</head>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flickr</title>
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<style type="text/css">
body {font-family: Verdana;}
.photo {display: inline-block; padding: 10px; width: 400px; height: 300px;}
#count {font-weight: bold;}
--------------------Mrs-Rabbit.html
<img src="http://www.tonightsbedtimestory.com/wp-content/uploads/2008/11/the-tale-of-peter-rabbit-5.jpg">
<div>A strong, practical mother, Mrs. Rabbit provides for her brood in the most resourceful and traditional ways. Mrs. Rabbit represents the heart of Peter's home life. No matter what happens to him, no matter how much trouble he gets into, Peter knows that his mother will always welcome him home with unconditional love and a warm embrace. Flopsy & Mopsy, <span class="rabbits" data-url="Benjamin">Cotton-tail</span> and <span class="rabbits" data-url="Peter">Peter</span> are her bunnies.
</div>
-------------------Cotton-Tail.html
<img src="http://criminalbrief.com/wp-content/uploads/2009/09/Peter-Rabbit-1.jpg">
<div>The youngest of Mrs. Rabbit's brood, Cotton-tail is a lovable and adorable 18-month-old. A child of few words, she clearly adores her big brother Peter and tries to copy his every move. Cotton-tail has an uncanny way of involving herself in Peter's
<!doctype html>
<html lang="en">
<head>
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<meta charset="UTF-8">
<title>Ajax Call</title>
<style type="text/css">
body {font-family: Verdana; font-size: 14px}
.rabbits {cursor: pointer; color: red;}
#AboutRabbits {padding: 20px;}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form</title>
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet">
<script src="//netdna.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<script type="text/javascript">