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 searchRecursive = function(dir, pattern) { | |
var results = []; | |
fs.readdirSync(dir).forEach(function (dirInner) { | |
// Obtain absolute path | |
dirInner = path.resolve(dir, dirInner); | |
var stat = fs.statSync(dirInner); | |
// If path is a directory, scan it and combine results | |
if (stat.isDirectory()) { | |
results = results.concat(searchRecursive(dirInner, pattern)); | |
} |
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
res.write('start'); | |
var files = searchRecursive(config.app.publicPath, '.scss'); | |
//foreach is not promise-aware. so use map | |
//map return promises | |
var promises = await files.map(async(scss)=>{ | |
var css = scss.replace('.scss','.min.css'); | |
var map = scss.replace('.scss','.min.css.map'); | |
var result = await sassAsyncRender(scss,css,map); | |
res.write(JSON.stringify({result})); |
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
async function asyncGetUserInfo(req) { | |
return new Promise((resolve) => { | |
if(!req.cookies.session){ | |
return resolve(null); | |
} | |
var data = {'sessionToken': req.cookies.session}; | |
hubsoft.getUserInfo(data, function (err, result) { | |
utils.cleanupObject(result); | |
if (!!result && (!result.out.errors || !result.out.errors.ErrorDTO || !result.out.errors.ErrorDTO.length)) { | |
resolve(result.out); |
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
.flip-card-inner { | |
transition: transform 0.6s; | |
transform-style: preserve-3d; | |
} | |
/* Do an horizontal flip when you move the mouse over the flip box container */ | |
.flip-card:hover .flip-card-inner { | |
transform: rotateY(180deg); | |
} |
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
//common state for different inputs | |
function RegisterYourCatForm() { | |
const [values, setValues] = useState({ | |
name: '', color: '', age: '', habits: '' | |
}); | |
const set = name => { | |
return ({ target: { value } }) => { | |
setValues(oldValues => ({...oldValues, [name]: value })); | |
} |
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
//https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/258887/sending-unique-email-via-web-api-crm/728165 | |
/* | |
otherlinks: https://community.dynamics.com/365/f/dynamics-365-general-forum/359828/execute-sendemailfromtemplate-web-api-action-from-js | |
*/ | |
//-- /api/data/v8.2/emails | |
//Method: POST | |
{ |
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
public static double CalculateTimeDifference(DateTime startDate, DateTime endDate, Boolean excludeSat, Boolean excludeSun, List<DateTime> excludeDates, string businessStartTime, string businessEndTime) | |
{ | |
//find working hours in a day | |
var tsBusinessStartTime = TimeSpan.Parse(businessStartTime); | |
var tsBusinessEndTime = TimeSpan.Parse(businessEndTime); | |
var businessHours = (tsBusinessEndTime - tsBusinessStartTime).TotalHours; | |
Console.WriteLine(businessHours); | |
if (startDate.TimeOfDay < tsBusinessStartTime) //email received before business hr |
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
function Get-SQLTable | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true)] | |
[string] $SourceSQLInstance, | |
[Parameter(Mandatory=$true)] | |
[string] $SourceDatabase, |
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
Math.round(sclCriterias.rate * 1e2) / 1e2; //round to 2 decimal places | |
const data = Object.fromEntries(new FormData(event.currentTarget)) //create JSON object from form entries | |