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 speaker = function (state) { | |
var words = state.words; | |
return { | |
talk: function () { | |
console.log(state.name + ' says ' + words); | |
} | |
}; | |
}; |
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 person = function (name, age) { | |
var state = { | |
name: name, | |
age: age, | |
words: 'Hello' | |
}; | |
return Object.assign( // Merge our 'behavior objects | |
{}, | |
speaker(state), |
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 James = person('James', 36); | |
fred.talk(); // outputs: James says Hello | |
fred.walk(); // outputs: James is walking | |
var myOwl = owl('SleepyOwl', 'grey'); | |
myOwl.walk(); // outputs: SleepyOwl is walking | |
myOwl.run(); // outputs: SleepyOwl is running | |
myOwl.talk(); // ERROR: myOwl.talk is not a function |
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 PROC SearchAllTables ( @SearchStr nvarchar(100) ) AS | |
BEGIN | |
CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630)) | |
SET NOCOUNT ON | |
DECLARE @TableName nvarchar(256), | |
@ColumnName nvarchar(128), | |
@SearchStr2 nvarchar(110) |
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
class Profile { | |
constructor(name) { | |
console.log('User ${name} was created.'); | |
this.name = name; | |
} | |
} | |
// How to instantiate the class | |
const user = new MyClass('Aram'); // logs: "User Aram was created" |
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
class Car { | |
constructor() { | |
this.logger = console.log; | |
} | |
log() { | |
this.logger(`Hello ${this.name}`); | |
} | |
} | |
class SuvCar extends Car { |
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
class MyClass { | |
static myStaticMethod() { | |
return 'Hello'; | |
} | |
static get myStaticProperty() { | |
return 'Goodbye'; | |
} | |
} |
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
;With | |
CTE1 AS ( | |
SELECT Id, ProductName , ROW_NUMBER() OVER(ORDER BY Id ) AS RowId FROM @MyTable ), | |
CTE2 AS ( | |
SELECT ProductName, RowId, RowId As MyGroup | |
FROM CTE1 WHERE [Group] IS NOT NULL | |
Union All SELECT A.ProductName, A.RowId, B.MyGroup | |
FROM CTE1 A | |
INNER JOIN CTE2 B | |
On A.RowId = B.RowId + 1 Where A.[Group] IS NULL ) |
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
-- First of all I'll just put the data from my main table into a temp table | |
-- just to make sure i am not destroying the actual data if something went wrong. | |
SELECT * INTO #Temp FROM ImportedSales; | |
;With CTE As | |
( | |
SELECT ProductName , Id , COUNT(ProductName) | |
OVER(ORDER BY Id ROWS UNBOUNDED PRECEDING) As MyGroup FROM #Temp ), GetProduct AS ( | |
SELECT [ProductName] , First_Value(ProductName) | |
OVER(PARTITION BY MyGroup | |
ORDER BY Id ROWS UNBOUNDED PRECEDING |
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
import { Component } from '@angular/core'; | |
@Component({ | |
moduleId: module.id, | |
selector: 'hotel-reservation', | |
templateUrl: './hotel-reservation.template.html' | |
}) | |
export class HotelReservationComponent { | |
public fName: string = 'Joe'; | |
public lName: string = 'SCHMO'; |
OlderNewer