Skip to content

Instantly share code, notes, and snippets.

Avatar

Christy Lewis cmlewis

View GitHub Profile
@cmlewis
cmlewis / ..Emarsys API Samples - Node js
Last active Aug 29, 2018
Emarsys API Samples - Node.js
View ..Emarsys API Samples - Node js
Emarsys API Samples - Node.js
@cmlewis
cmlewis / agendaJobSameNameDifferentConfig.js
Created Apr 12, 2018
Agenda - create multiple job definitions with same name, different job config
View agendaJobSameNameDifferentConfig.js
// Create each job with the same name so we can control concurrency (the number of parallel jobs that can be run).
// Each job will have the same name, but different configs. Use the 'unique' method to prevent duplicates.
agenda.define('MyJob', {concurrency: 3}, loadData);
_.each(myJobs, function(job){
agenda.create('MyJob', job)
.unique({'job.name': job.name}, { insertOnly: true })
.repeatEvery('1 hour')
.save();
});
@cmlewis
cmlewis / AlfrescoGetTotalObjectCountForOneType.js
Created Sep 27, 2017
Get the total number of objects (files or folders) of a particular type in Alfresco. This helps bypass Alfresco's query limit of 1000.
View AlfrescoGetTotalObjectCountForOneType.js
// Get the total number of objects of one type.
// This accounts for the query limits in Alfresco (which is 1000 results by default)
var query = 'TYPE:"myco:document"';
var totalNumOfDocs = 0;
do {
var page = {
maxItems: 1000,
@cmlewis
cmlewis / Alfresco-UpdatePermissionsOnNode.js
Created Aug 7, 2017
Alfresco - Update Permissions on Node
View Alfresco-UpdatePermissionsOnNode.js
var nodes = search.luceneSearch('@hpi\\:trac:"HR"');
logger.log("Document Count: " + nodes.length);
for each(var node in nodes) {
node.setPermission("Read", "GROUP_HR");
node.setPermission("Read", "GROUP_HPI_CONSUMERS");
}
@cmlewis
cmlewis / ffmpeg_copy_MTSorAVCHD_to_mp4.bat
Last active Sep 3, 2016
Copy AVCHD (MTS or MTS2) to MP4 using ffmpeg
View ffmpeg_copy_MTSorAVCHD_to_mp4.bat
ffmpeg -i 00002.MTS -vcodec copy 00002.mp4
@cmlewis
cmlewis / wp_display_all_custom_fields.php
Created Jun 21, 2016
Wordpress - Display all custom fields
View wp_display_all_custom_fields.php
<?php
$custom_fields = get_post_custom();
foreach ( $custom_fields as $field_key => $field_values ) {
foreach ( $field_values as $key => $value )
echo $field_key . ' - ' . $value . '<br />';
}
?>
@cmlewis
cmlewis / Alfresco-CreateManyMajorAndMinorVersions.js
Created Apr 5, 2015
Alfresco - Automate creation of many major and minor versions
View Alfresco-CreateManyMajorAndMinorVersions.js
var numMinorVersions = 15;
var numMajorVersions = 2;
for (var i = 0; i < numMinorVersions; i++) {
document.createVersion("automated minor version", false);
}
for (var i = 0; i < numMajorVersions; i++) {
document.createVersion("automated major version", true);
View Delete Windows Service.bat
call sc.exe delete MyServiceName
@cmlewis
cmlewis / Create Windows Service via Command_ Line.bat
Last active Aug 29, 2015
Create Windows Service via Command Line
View Create Windows Service via Command_ Line.bat
call sc.exe create MyNewServiceName binPath= "\"C:\path\to\bin\mybin.exe\" --service --config
= \"C:\path\to\config\myconfig.cfg\"" DisplayName= "My New Service" start= "auto"
You can’t perform that action at this time.