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
# PushTo-S3 script | |
# | |
# Description: | |
# Copies the source files to an S3 bucket | |
# | |
# Usage: | |
# PushTo-S3 -SourcePath [Path] -AwsAccessKey [KEY] -AwsSecretKey [SECRET] -AwsRegion [REGION] -S3BucketName [BUCKET] | |
# | |
# Example: | |
# ./PushTo-S3 -SourcePath "./dist" -AwsAccessKey "KEY" -AwsSecretKey "SECRET" -AwsRegion "REGION" -S3BucketName "BUCKET" |
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
// -------------------------------- | |
// Simple dynamic template string | |
const fillTemplate = function(templateString, templateVars){ | |
return new Function('return `' + templateString + '`;').call(templateVars); | |
} | |
const templateString = "Hello ${this.name}!"; | |
const templateVars = { name: 'world' } | |
fillTemplate(templateString, templateVars) //? |
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
// Imperative | |
let numbers = []; | |
for(let i = 0; i < 10; i++) { | |
numbers.push(i); | |
} | |
numbers //? | |
// Declaritive | |
;[...Array(10).keys()] //? |
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
DECLARE @SearchStr nvarchar(100) | |
SET @SearchStr='Search String' | |
BEGIN | |
CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630)) | |
SET NOCOUNT ON | |
DECLARE |
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
@echo off | |
rem ## --- User variables --- | |
@set URL=<deploy_site_url> | |
rem ## --- Other variables --- | |
@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN;%PATH% | |
@set FEATURE_NAME=<wsp_feature_name> | |
@set WSP_NAME=<wsp_name> | |
@set WSP_FILE=%WSP_NAME% |
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 a jquery plugin that prints the given element. | |
jQuery.fn.print = function () { | |
// Ensure there is only a single element in the jquery collection | |
if (this.size() > 1) { | |
this.eq(0).print(); | |
return; | |
} | |
else if (!this.size()) { | |
return; | |
} |
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
DECLARE @dbName nvarchar(max) = '<db_name>' | |
DECLARE @path nvarchar(max) = '<destination_path>' | |
DECLARE @date datetime = GETDATE() | |
DECLARE @timeStamp nvarchar(max) = CONVERT(nvarchar(max), @date, 112) + '-' + REPLACE(CONVERT(nvarchar(max), @date, 108), ':', '') | |
DECLARE @fileName nvarchar(max) = @path + @dbName + '_' + @timeStamp + '.bak' | |
BACKUP DATABASE @dbName TO DISK = @fileName | |
GO |
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
// Extend the String type to include a format method | |
String.prototype.format = function (format, args) { | |
var s = arguments[0]; | |
for (var i = 0; i < arguments.length - 1; i++) { | |
var reg = new RegExp("\\{" + i + "\\}", "gm"); | |
s = s.replace(reg, arguments[i + 1]); | |
} | |
return 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
if (this.JSON && !this.JSON.parseWithDate) { | |
var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/; | |
var reMsAjax = /^\/Date\((d|-|.*)\)[\/|\\]$/; | |
JSON.parseWithDate = function (json) { | |
/// <summary> | |
/// parses a JSON string and turns ISO or MSAJAX date strings | |
/// into native JS date objects | |
/// </summary> | |
/// <param name="json" type="var">json with dates to parse</param> |
NewerOlder