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
| /* | |
| The referenced views (which could also be tables) are one-column views | |
| (or tables) that contain instances of the particular type of name. For | |
| [EnglishMaleFirstNameView] and [EnglishFemaleFirstNameView], the one | |
| column must be named [Name]. For [EnglishSurnamePrefixView], the one | |
| column must be named [Prefix]. This view can contain surnames that would | |
| otherwise stand alone. For [EnglishSurnameSufffixView], the one column | |
| must be named [Suffix]. Each element of this list must not be | |
| capitalized. This list should contain an empty string element so that | |
| the prefix can stand alone. Examples of each of these views are |
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
| CREATE TABLE Numbers | |
| ( | |
| N INT NOT NULL, | |
| CONSTRAINT PK_Numbers | |
| PRIMARY KEY CLUSTERED (N) | |
| WITH FILLFACTOR = 100 | |
| ) | |
| INSERT INTO Numbers (N) | |
| SELECT ROW_NUMBER() OVER(ORDER BY a.n,b.n,c.n,d.n,e.n,f.n,g.n,h.n,i.n,j.n) AS [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
| CREATE FUNCTION [dbo].[Split] ( | |
| @List nvarchar(MAX), | |
| @Delimiter nvarchar(3) | |
| ) | |
| RETURNS TABLE | |
| WITH SCHEMABINDING | |
| AS | |
| RETURN ( | |
| SELECT ROW_NUMBER() OVER(ORDER BY N) AS [Ordinal], | |
| SUBSTRING(@List, N, CHARINDEX(@Delimiter, @List + @Delimiter, N) - N) AS [Item] |
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
| SELECT [Item] | |
| FROM sys.sql_modules | |
| CROSS APPLY ( | |
| SELECT ROW_NUMBER() OVER(ORDER BY N) AS [Ordinal], | |
| SUBSTRING([definition], N, CHARINDEX(CHAR(13), [definition] + CHAR(13), N) - N) AS [Item] | |
| FROM dbo.Numbers | |
| WHERE N <= CONVERT(INT, LEN([definition])) | |
| AND SUBSTRING(CHAR(13) + [definition], N, 1) = CHAR(13) | |
| ) t | |
| WHERE OBJECT_NAME(object_id) = 'OBJECTNAME' |
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
| // a, b: Date-time value (null if unknown or "never") | |
| // altCompare: An alternative comparison function(a,b). | |
| function recencyCompare(a,b) { | |
| if (!a && !b) return altCompare(a,b); | |
| if (!a) return 1; // 'b' has an error and 'a' doesn't | |
| if (!b) return -1; // 'a' has an error and 'b' doesn't | |
| if (a == b) { return altCompare(a,b); } | |
| return a < b ? 1 : -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
| var second = 1e3; | |
| var minute = 6e4; | |
| var hour = 36e5; | |
| var day = 864e5; | |
| var week = 6048e5; | |
| function ago(diff) { | |
| var unit, num; | |
| if (diff <= second) { | |
| unit = 's'; |
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
| SELECT | |
| arrays.firstnames[s.a % ARRAY_LENGTH(arrays.firstnames,1) + 1] AS firstname, | |
| substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ' from s.a%26+1 for 1) AS middlename, | |
| arrays.lastnames[s.a % ARRAY_LENGTH(arrays.lastnames,1) + 1] AS lastname | |
| FROM generate_series(1,300) AS s(a) -- number of names to generate | |
| CROSS JOIN( | |
| SELECT ARRAY[ | |
| 'Adam','Bill','Bob','Calvin','Donald','Dwight','Frank','Fred','George','Howard', | |
| 'James','John','Jacob','Jack','Martin','Matthew','Max','Michael', | |
| 'Paul','Peter','Phil','Roland','Ronald','Samuel','Steve','Theo','Warren','William', |
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
| SELECT | |
| ROW_NUMBER() OVER (ORDER BY surnames.[Surname],firstNames.[FirstName]) AS [Ordinal], | |
| firstNames.[Gender], | |
| firstNames.[FirstName], | |
| surnames.[Surname] | |
| FROM ( | |
| SELECT 'M' AS [Gender], [FirstName] | |
| FROM ( | |
| SELECT 'Alberto' AS [FirstName] | |
| UNION SELECT 'Angel' UNION SELECT 'Benito' UNION SELECT 'Carlos' UNION SELECT 'Domingo' UNION SELECT 'Fernando' UNION SELECT 'Federico' UNION SELECT 'Fidel' |
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
| composition.addBindingHandler('console', { | |
| update: function (element, valueAccessor, allBindings) { | |
| data = ko.toJS(valueAccessor() || allBindings()); | |
| console.log(data); | |
| } | |
| }); |
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
| Option Explicit On | |
| Imports System | |
| Imports System.Text | |
| Imports System.Text.RegularExpressions | |
| Imports System.Net | |
| Imports System.Xml | |
| Imports System.IO | |
| Namespace Collecta |
OlderNewer