Skip to content

Instantly share code, notes, and snippets.

@Atinux
Atinux / async-foreach.js
Last active October 10, 2023 03:04
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
///========================================
/// SoftPhone s.r.l
/// IWSConnector release 1.1.4.0
/// Date: 08/08/2013
///========================================
// CHECK IF THE IWS AGENT IS THE SAME LOGGED IN SIEBEL
// WITHOUT AGENT INTEGRITY THE AGENT IS LOGGED OUT
/**
* CheckAgentIntegrity
@ankamguru
ankamguru / iwscript.js
Created June 8, 2014 09:22
iwscript.js
///========================================
/// SoftPhone s.r.l
/// IWSConnector release 1.1.4.0
/// Date: 07/08/2013
///========================================
function networkError(message)
{
trace(message);
}
@chrislkeller
chrislkeller / import_json_appsscript.js
Last active March 25, 2024 19:45
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@parente
parente / runinenv.sh
Created February 15, 2011 01:54
run a command in virtualenv, useful for supervisord
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@dzuelke
dzuelke / mkv2m4v.sh
Created October 22, 2010 22:07 — forked from innerfence/mkv2m4v.sh
Convert .mkv video to iPad compatible .m4v without re-encoding
#!/bin/bash
#
# mkv2m4v inputfile.mkv
#
# Given an MKV container with H.264 video & AC3 or DTS audio, converts
# quickly to an iPad-compatible MP4 container without re-encoding the
# video (so it must already be in an iPad-compatible resolution); the
# audio is downmixed to stereo with Dynamic Range Compression.
#
ME=$(basename $0)