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 OR REPLACE FUNCTION friendly_date_diff( | |
| TIMESTAMP WITH TIME ZONE | |
| ) | |
| RETURNS TEXT | |
| LANGUAGE sql | |
| IMMUTABLE | |
| STRICT | |
| AS $$ | |
| SELECT CASE |
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
| sub inarray | |
| { | |
| my ( $value, @array ) = @_; | |
| foreach my $arrayvalues ( @array ) | |
| { | |
| foreach my $arrayvalue ( @$arrayvalues ) | |
| { | |
| if ( $arrayvalue eq $value ) | |
| { |
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
| /* | |
| Tables using Sequential Scans | |
| Identifies tables that are not using indexes very often | |
| */ | |
| SELECT | |
| relname AS "Table Name", | |
| n_live_tup "Row Count", | |
| 100 * idx_scan / (seq_scan + idx_scan) "% Times Used" | |
| FROM pg_stat_user_tables | |
| WHERE seq_scan + idx_scan > 0 |
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 OR REPLACE FUNCTION is_email( | |
| anyelement | |
| ) | |
| RETURNS boolean | |
| LANGUAGE sql | |
| IMMUTABLE | |
| STRICT | |
| AS $$ | |
| SELECT $1::TEXT ~ '^\S+@\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
| CREATE OR REPLACE FUNCTION array_length( | |
| ANYARRAY, | |
| INT | |
| ) | |
| RETURNS SETOF INT | |
| LANGUAGE sql | |
| IMMUTABLE | |
| STRICT | |
| AS $$ |
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
| if (typeof String.prototype.startsWith !== 'function') { | |
| String.prototype.startsWith = function(str) { | |
| return this.slice(0, str.length) === str; | |
| }; | |
| } |
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
| if (typeof String.prototype.ucWords !== 'function') { | |
| String.prototype.ucWords = function() { | |
| return this.replace(/^([a-z])|\s+([a-z])/g, function($1) { | |
| return $1.toUpperCase(); | |
| }); | |
| }; | |
| } |
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 OR REPLACE FUNCTION is_int(anyelement) | |
| RETURNS boolean AS | |
| $$ | |
| SELECT $1::TEXT ~ '^[-+]?[0-9]+$'; | |
| $$ | |
| LANGUAGE sql IMMUTABLE STRICT; |
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 Shared Function pathAsUnc(ByVal fileName As String) As String | |
| Dim file As New System.IO.FileInfo(filename.ToLowerInvariant) | |
| If Not file.Exists Then | |
| Return String.Empty | |
| End If | |
| Dim oldDrive As String = file.Directory.Root.FullName | |
| Dim uncPath As Object = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Network\" & oldDrive.Remove(1), "RemotePath", Nothing) | |
| Dim uri As Uri |
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 OR REPLACE FUNCTION is_numeric( | |
| ANYELEMENT | |
| ) | |
| RETURNS BOOLEAN | |
| LANGUAGE sql | |
| IMMUTABLE | |
| STRICT | |
| AS $$ | |
| SELECT $1::TEXT ~ '^[-+]?[0-9]*[.]?[0-9]+$'; |