### Example Mustache Template Source: https://github.com/spullara/mustache.java/blob/main/README.md An example of a Mustache template file demonstrating iteration over 'items', displaying 'name' and 'price', and nested iteration over 'features' with a 'description'. ```mustache {{#items}} Name: {{name}} Price: {{price}} {{#features}} Feature: {{description}} {{/features}} {{/items}} ``` -------------------------------- ### Basic Mustache.java Template Execution (Java) Source: https://github.com/spullara/mustache.java/blob/main/README.md Provides a complete example of using Mustache.java to compile and execute a template. It sets up a `MustacheFactory`, compiles a template named 'template.mustache', and executes it with an `Example` object providing the data. ```java package mustachejava; import com.github.mustachejava.DefaultMustacheFactory; import com.github.mustachejava.Mustache; import com.github.mustachejava.MustacheFactory; import java.io.IOException; import java.io.PrintWriter; import java.io.Writer; import java.util.Arrays; import java.util.List; public class Example { List items() { return Arrays.asList( new Item("Item 1", "$19.99", Arrays.asList(new Feature("New!"), new Feature("Awesome!"))), new Item("Item 2", "$29.99", Arrays.asList(new Feature("Old."), new Feature("Ugly."))) ); } static class Item { Item(String name, String price, List features) { this.name = name; this.price = price; this.features = features; } String name, price; List features; } static class Feature { Feature(String description) { this.description = description; } String description; } public static void main(String[] args) throws IOException { MustacheFactory mf = new DefaultMustacheFactory(); Mustache mustache = mf.compile("template.mustache"); mustache.execute(new PrintWriter(System.out), new Example()).flush(); } } ``` -------------------------------- ### Run Minecraft Server Source: https://github.com/spullara/mustache.java/blob/main/compiler/src/test/resources/psauxwww.txt This snippet shows the command to launch a Minecraft server using Java. It specifies memory allocation and the server JAR file, indicating a typical setup for running a dedicated Minecraft server. ```bash /usr/bin/java -Xmx1024M -Xms1024M -jar minecraft_server.1.6.2.jar nogui ``` -------------------------------- ### Track Ad Start Performance (JavaScript) Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html This function, `onStartPosRender`, is designed to be called when an ad position starts rendering. It records the start time using `window.performance.now()` and pushes this performance data, along with the ad position ID, into a `_adLT` array for later analysis. It also marks performance for modal-related ad starts. ```JavaScript C.onStartPosRender = function(posItem) { if (window.performance && window.performance.now) { var ltime = window.performance.now(), posId = posItem && posItem.pos; _adLT.push(['ADSTART_'+posId, Math.round(ltime)]); } if (window._isModalOpen && window._isModalOpen()) { window._perfMark('ADSTART_' + posId); } }; ``` -------------------------------- ### Initialize YAFT with Configuration Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html This snippet shows the initialization of the YAFT library with a detailed configuration object. The configuration includes an array of modules to load, modules to exclude, and flags for controlling features like visual reports and native start rendering. It also sets up a plugin for ad-related functionalities. ```JavaScript function yaftInit(e) { if (window.YAFT !== undefined) { var __yaftConfig = { modules: [ "mega-uh-wrapper", "applet_p_", "ad-north-base", "fea-", "my-adsFPAD-base", "my-adsLREC-base", "my-adsMAST", "my-adsLDRB", "my-adsUBALDRB", "my-adsTXTL", "content-modal-", "hl-ad-LREC-", "modal-sidekick-", "hl-ad-LREC-0", "hl-ad-MON-0", "hl-ad-MAST-0", "hl-ad-LDRB-0", "hl-ad-SPL2-0", "hl-ad-SPL-0" ], modulesExclude: ["UH-Search", "UH-ColWrap", "my-adsMAST-base"], canShowVisualReport: false, useNormalizeCoverage: true, includeOnlyAft2: true, useNativeStartRender: true, useNativeStartRenderMeaningful: false, customReportModules: [], modulesAft2Container: ["hl-viewer"], maxWaitTime: 6000 }; __yaftConfig.plugins = []; __yaftConfig.plugins.push({ name: 'aftnoad', isPre: true, config: { useNormalizeCoverage: true, adModules: [ "ad-north-base", "my-adsFPAD-base", "my-adsLREC-base", "my-adsTL1", "my-adsMAST", "my-adsLDRB", "my-adsUBALDRB", "hl-ad-LREC-0", "hl-ad-MAST-0", "hl-ad-LDRB-0", "hl-ad-SPL2-0", "my-adsTXTL", "hl-ad-SPL-0" ] } }); window.aft2CB = function(data, error) { if (!error) { var aft2 = Math.round(data.aft); var vic2 = data.visuallyComplete; var srt2 = Math.round(data.startRender); var rapidInstance = (YAHOO && YAHOO.i13n && YAHOO.i13n.rapidInstance) || (YMedia && YMedia.My && YMedia.My.App && YMedia.My.App.getRapidTracker && YMedia.My.App.getRapidTracker()) || null; if (rapidInstance) { var afterPageLoad = { AFT: aft2, AFT2: aft2, STR: srt2, VIC: vic2 }; var perfData = { perf_commontime: { afterPageLoad: afterPageLoad } }; var pageParamsObject = null; if (rapidInstance.getRefererSpaceid) { pageParamsObject = { ref_sp: rapidInstance.getRefererSpaceid(), visit_sp: (window.Af && window.Af.config && window.Af.config.spaceid) }; } rapidInstance.beaconPerformanceData(perfData, pageParamsObject); } } }; window.YAFT.init(__yaftConfig, function(data, error) { var i; if (!error) { try { var rapidInstance = YAHOO.i13n.rapidInstance ? YAHOO.i13n.rapidInstance : (YMedia.My && YMedia.My.App && YMedia.My.App.getRapidTracker) ? YMedia.My.App.getRapidTracker() : null; if(rapidInstance) { var initialPageLoad = { AFT: Math.round(data.aft), AFT1: Math.round(data.aft), STR: data.startRender, VIC: data.visuallyComplete, PLT: data.pageLoadTime, DOMC: data.domElementsCount, HTTPC: data.httpRequests.count, CP: data.totalCoveragePercentage, NCP: data.normTotalCoveragePercentage }; if(data.aftNoAd) { initialPageLoad.AFTNOAD = Math.round(data.aftNoAd); } var customPerfData = {}, pagePerfData = {}, results = []; var yaftResults = [0], yaftModule = '', yaftIndex = ''; for (yaftModule in data.modulesReport) { for (yaftIndex in data.modulesReport[yaftModule].resources) { yaftResults.push(Math.round(data.modulesReport[yaftModule].resources[yaftIndex].durationFromNStart)); } } pagePerfData['COSTLY_RESOURCE'] = Math.max.apply(null, yaftResults); pagePerfData['X_FB1'] = 32; pagePerfData['X_FBN'] = 51; if (window.FPAD_rendered) { pagePerfData['xAFT'] = data.aft; pagePerfData['xPLT'] = data.pageLoadTime; if (window.rtFpadAdStart) { pagePerfData['ADSTART_FPAD'] = Math.round(window.rtFpadAdStart); if (window.rtAdStart) { pagePerfData['ADCSTART_FPAD'] = Math.round(window.rtAdStart); } var adEndTime = window.rtAdDone ? window.rtAdDone : (window.performance && window.performance.now && window.performance.now()); pagePerfData['ADEND_FPAD'] = Math.round(adEndTime); } } if ( window._adLT) { for (var i = 0; i< _adLT.length; i++) { pagePerfData[_adLT[i][0]] = _adLT[i][1]; } } if(resourceTimingAssets) { for(i in resourceTimingAssets) { if (resourceTimingAssets.hasOwnProperty(i)) { resourceName = window.performance.getEntriesByName(resourceTimingAssets[i]); if(resourceName && resourceName.length) { var resourceFinish = resourceName[0].responseEnd; pagePerfData[i] = Math.round(resourceFinish); } } } } if (window && window.performance && window.performance.getEntriesByType) { var perfMarks = window.performance.getEntriesByType('mark'); var _l = perfMarks.length; var startStopRegexp = / (START|STOP)/; for(i = 0; i < _l; i++) { if (startStopRegexp.test(perfMarks[i].name)) { pagePerfData[perfMarks[i].name] = Math.round(perfMarks[i].startTime + perfMarks[i].duration); } } var perfMeasures = window.performance.getEntriesByType('measure'); _l = perfMeasures.length; var durationRegexp = /aptNew DUR/; for(i = 0; i < _l; i++) { if (durationRegexp.test(perfMeasures[i].name)) { pagePerfData[perfMeasures[i].name] = Math.round(perfMeasures[i].duration); } } } var navConnection = navigator && (navigator.connection || navigator.mozConnection || navigator.webkitConnection) || {}; pagePerfData['CONNECTION_TYPE'] = navConnection.effectiveType || 'unknown'; customPerfData['utm'] = pagePerfData; var perfData = { perf_commontime: { initialPageLoad: initialPageLoad } }; rapidInstance.beaconPerformanceData(perfData, pageParamsObject); } } catch (e) { console.error("YAFT init callback error: " + e); } } }); } } ``` -------------------------------- ### JavaScript UI Initialization and Event Handling Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html Initializes the search component, sets up event listeners for 'load', and manages UI elements like the search box, clear button, and container. It also handles ARIA live region setup for accessibility. ```JavaScript var t=function(){var e=navigator.userAgent;var t=new RegExp("MSIE ([0-9]{1,}\[.0-9]{0,})").exec(e);return t&&t\[1\]&&parseFloat(t\[1\])}();return e.YAHOO=e.YAHOO||{},v.prototype={ set:function(e,t,s){e.setAttribute(t,s)}, get:function(e,t){return e.getAttribute(t)}, merge:a, extend:i, buildUrl:n, stopPropagation:f, setFocus:o, cursorEnd:c, select:h, htmlEncode:u, ae:g, de:d, ts:m, bold:w, debug:function(t){this.config.debug&&e.console&&e.console.log&&e.console.log(t)}} ,i(x,v),x.prototype.init=function(s,i){ var a=this; if(this.saModel=i,this.config=s,this.clearButton=this.clearButton||t.getElementById(this.config.clearButtonId),this.searchbox=this.searchbox||t.getElementById(this.config.searchBoxId),!this.searchbox)return!1; this.config.gossipParam.pq=this.searchbox.value; for(var n=this.searchbox;n&&!this.formTag;)n.tagName&&"form"===n.tagName.toLowerCase()&&(this.formTag=n),n=n.parentNode; return this.formTag?(this.container=t.createElement("div"),this.container.className=this.config.cssClass.container,this.trayContainer=t.createElement("div"),this.trayContainer.className=this.config.cssClass.trayContainer,this.container.appendChild(this.trayContainer),this.searchbox.parentNode.insertBefore(this.container,this.searchbox.nextSibling),this.searchbox.setAttribute("role","combobox"),this.searchbox.setAttribute("aria-autocomplete","both"),this.ae(e,"load",function(){a.aria=t.createElement("div"),a.aria.className=a.config.cssClass.aria,a.set(a.aria,"aria-live","polite"),a.aria.style.position="absolute",a.aria.style.left="-9999px",t.body.appendChild(a.aria)}),!0):!1} ``` -------------------------------- ### Get Data from Element Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html Retrieves data attributes from a specified DOM element and parses them into an object. ```JavaScript O=function(a,b){return a?N(a.getAttribute(b)):{} } ``` -------------------------------- ### Execute Java with Specific Arguments Source: https://github.com/spullara/mustache.java/blob/main/compiler/src/test/resources/psauxwww.txt This snippet shows a Java process being executed with various command-line arguments. These arguments configure the Java Virtual Machine (JVM) for headless operation, memory allocation, file encoding, and include a comprehensive classpath for dependencies. It also specifies the main class to be executed by the Maven server. ```bash /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -d64 -Djava.awt.headless=true -Xmx512m -Dfile.encoding=UTF-8 -classpath /Applications/Cardea-IU-130.1179.app/lib/resources_en.jar:/Applications/Cardea-IU-130.1179.app/lib/oromatcher.jar:/Applications/Cardea-IU-130.1179.app/lib/jna.jar:/Applications/Cardea-IU-130.1179.app/lib/jna-utils.jar:/Applications/Cardea-IU-130.1179.app/lib/util.jar:/Applications/Cardea-IU-130.1179.app/lib/log4j.jar:/Applications/Cardea-IU-130.1179.app/lib/picocontainer.jar:/Applications/Cardea-IU-130.1179.app/lib/jdom.jar:/Applications/Cardea-IU-130.1179.app/lib/annotations.jar:/Applications/Cardea-IU-130.1179.app/lib/trove4j.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/lucene-core-2.4.1.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven-server-api.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2-server-impl.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/activation-1.1.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/archetype-common-2.0-alpha-4-SNAPSHOT.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/classworlds-1.1.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/commons-beanutils.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/jaxb-api.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/jaxb-impl.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/maven-2.2.1-uber.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/maven-dependency-tree-1.2.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/mercury-artifact-1.0-alpha-6.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/nexus-indexer-1.2.3.jar:/Applications/Cardea-IU-130.1179.app/plugins/maven/lib/maven2/plexus-utils-1.5.5.jar org.jetbrains.idea.maven.server.RemoteMavenServer ``` -------------------------------- ### Get YLC Parameter Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html Retrieves the YLC (Yahoo Live Connect) parameter from the YAHOO.SA.config object, which contains configuration for search suggestions. ```JavaScript L=function(a){var b,c=a||YAHOO;return c&&c.SA&&c.SA.config&&c.SA.config.ylcParam&&(b=c.SA.config.ylcParam),b } ``` -------------------------------- ### Initialize Yahoo Ad Configuration Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html Sets up the primary configuration object 'C' for Yahoo's ad services. This includes defining service paths, beacon paths, render paths, and various ad positions with their specific attributes and supported features. It also initializes variables for ad performance data and pending ads. ```JavaScript var flInstalled=1; var customSiteAttr="megamodal=true"; var facCustomTimout = 380; var w = window, D = w.DARLA, C = {"useYAC":0,"usePE":0,"servicePath":"https:\/\/www.yahoo.com\/sdarla\/php\/fc.php","xservicePath":"","beaconPath":"https:\/\/www.yahoo.com\/sdarla\/php\/b.php","renderPath":"","allowFiF":false,"srenderPath":"https:\/\/s.yimg.com\/rq\/darla\/3-4-0\/html\/r-sf.html","renderFile":"https:\/\/s.yimg.com\/rq\/darla\/3-4-0\/html\/r-sf.html","sfbrenderPath":"https:\/\/s.yimg.com\/rq\/darla\/3-4-0\/html\/r-sf.html","msgPath":"https:\/\/fc.yahoo.com\/unsupported-1946.html","cscPath":"https:\/\/s.yimg.com\/rq\/darla\/3-4-0\/html\/r-csc.html","root":"sdarla","edgeRoot":"http:\/\/l.yimg.com\/rq\/darla\/3-4-0","sedgeRoot":"https:\/\/s.yimg.com\/rq\/darla\/3-4-0","version":"3-4-0","tpbURI":"","hostFile":"https:\/\/s.yimg.com\/rq\/darla\/3-4-0\/js\/g-r-min.js","beaconsDisabled":true,"rotationTimingDisabled":true,"fdb_locale":"What don't you like about this ad?|It's offensive|Something else|Thank you for helping us improve your Yahoo experience|It's not relevant|It's distracting|I don't like this ad|Send|Done|Why do I see ads?|Learn more about your feedback.","positions":{"DEFAULT":{"supports":false},"HPSPON":{"w":1,"h":1},"FPAD":{"w":1,"h":1},"LREC":{"w":300,"h":250},"MAST":{"w":970,"h":250},"LDRB":{"w":1,"h":1},"MON":{"w":1,"h":1}},"lang":"en-US"}, _adPerfBeaconData, _pendingAds = [], _adLT = []; ``` -------------------------------- ### Java Context for Template Source: https://github.com/spullara/mustache.java/blob/main/README.md This Java code snippet provides the backing data structure for the example Mustache template. It defines an 'Item' class with 'name', 'price', and a list of 'Feature' objects, each having a 'description'. ```java public class Context { List items() { return Arrays.asList( new Item("Item 1", "$19.99", Arrays.asList(new Feature("New!"), new Feature("Awesome!"))), ``` -------------------------------- ### HTTP Request Methods (Read, Update, Create) Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html Provides methods for performing HTTP requests: 'read' (GET), 'update' (PUT), and 'create' (POST). These methods abstract the underlying request logic. ```javascript read:function(a,b){this._attemptRequest("GET",a,b)},update:function(a,b){this._attemptRequest("PUT",a,b)},create:function(a,b){this._attemptRequest("POST",a,b)} ``` -------------------------------- ### Using Loops and Conditionals in Mustache.java Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html This example illustrates how to use Mustache.java's features for iterating over lists and applying conditional logic within templates. It showcases the use of sections for loops and conditional rendering. ```java import com.github.mustachejava.DefaultMustacheFactory; import com.github.mustachejava.Mustache; import com.github.mustachejava.MustacheFactory; import java.io.StringWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MustacheLoopsAndConditionals { public static void main(String[] args) { MustacheFactory factory = new DefaultMustacheFactory(); Mustache mustache = factory.compile( "{{#users}}User: {{name}}, Active: {{#isActive}}{{isActive}}{{/isActive}}{{^isActive}}No{{/isActive}}.\n{{/users}}" ); Map context = new HashMap<>(); List> users = new ArrayList<>(); Map user1 = new HashMap<>(); user1.put("name", "Alice"); user1.put("isActive", true); users.add(user1); Map user2 = new HashMap<>(); user2.put("name", "Bob"); user2.put("isActive", false); users.add(user2); context.put("users", users); StringWriter writer = new StringWriter(); mustache.execute(writer, context); System.out.println(writer.toString()); } } ``` -------------------------------- ### Configure td-dev-info Modules Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html Sets up the td-dev-info component, including templates for initialization and performance metrics, with dependencies on overlay, node-core, and dust templating. ```JavaScript YUI.add("loader-td-dev-info",function(e,d){YUI.Env[e.version].modules=YUI.Env[e.version].modules||{},e.mix(YUI.Env[e.version].modules,{"td-dev-info":{group:"td-dev-info",requires:["overlay","node-core","td-dev-info-templates-perf"]},"td-dev-info-templates-init":{group:"td-dev-info",requires:["template-base","dust"]},"td-dev-info-templates-perf":{group:"td-dev-info",requires:["template-base","dust"]}})},"@VERSION@",{requires:["loader-base"]}); ``` -------------------------------- ### Monitor System Processes Source: https://github.com/spullara/mustache.java/blob/main/compiler/src/test/resources/psauxwww.txt This snippet demonstrates how to view a list of running processes, their resource consumption (CPU, Memory), and associated commands. It's a fundamental command for system monitoring. ```bash USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND sam 68703 82.7 15.2 2893856 1272968 ?? Rs 10:34AM 3:43.07 /Volumes/Data/Steam Content/common/Call of Duty Black Ops - OSX/CoDBlackOps.app/Contents/AppCoDMP.app/Contents/MacOS/AppCoDMP -DefaultChildApp AppCoDMP -appid 214640 root 76736 51.4 0.2 2469288 18452 ?? Ss Mon09AM 701:51.51 /usr/libexec/activitymonitord _spotlight 68769 12.7 0.1 2513936 6332 ?? SN 10:44AM 0:00.08 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker -s mdworker -c MDSImporterWorker -m com.apple.mdworker.shared sam 76734 10.0 0.2 2691364 20412 ?? S Mon09AM 273:48.87 /Applications/Utilities/Activity Monitor.app/Contents/MacOS/Activity Monitor -psn_0_10979960 sam 909 5.0 1.1 1075224 93292 ?? S 29Aug13 53:30.79 /Applications/Skype.app/Contents/MacOS/Skype -psn_0_475252 _windowserver 127 2.0 3.0 3624404 255304 ?? Ss 29Aug13 305:55.91 /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Resources/WindowServer -daemon sam 58687 1.9 1.7 1074736 145068 ?? S Fri09PM 133:22.32 /Applications/Google Chrome.app/Contents/Versions/31.0.1612.2/Google Chrome Helper.app/Contents/MacOS/Google Chrome Helper --type=renderer --lang=en-US --force-fieldtrials=AsyncDns/SystemDnsA/DnsProbe-Enable/enable/ForceCompositingMode/thread/GZippedProtobufs/GzippedProtobufsDisabled/GoogleNow/Default/InfiniteCache/No/LowLatencyFlashAudio/LowLatency/ManagedModeLaunch/Active/MostVisitedTilePlacement/Default/MouseEventPreconnect/Control/NetworkConnectivity/collect_stats/OmniboxBundledExperimentV1/Standard/OmniboxStopTimer/Standard/Prefetch/ContentPrefetchPrefetchOff/Prerender/PrerenderMulti/PrerenderFromOmnibox/OmniboxPrerenderEnabled/PrerenderLocalPredictorSpec/LocalPredictor=Disabled/SendFeedbackLinkLocation/default/Test0PercentDefault/group_01/UMA-Dynamic-Binary-Uniformity-Trial/group_01/UMA-Session-Randomized-Uniformity-Trial-5-Percent/group_02/UMA-Uniformity-Trial-1-Percent/group_47/UMA-Uniformity-Trial-10-Percent/group_08/UMA-Uniformity-Trial-100-Percent/group_01/UMA-Uniformity-Trial-20-Percent/default/UMA-Uniformity-Trial-5-Percent/default/UMA-Uniformity-Trial-50-Percent/group_01/ --enable-threaded-compositing --renderer-print-preview --disable-html-notifications --disable-accelerated-video-decode --channel=896.188.1644217566 sam 64810 1.5 1.5 1258392 122260 ?? S 8:43PM 15:02.41 /Applications/Steam.app/Contents/MacOS/osx32/steam -psn_0_23213602 sam 84083 0.9 4.5 3915220 373644 s004 R+ Mon11AM 173:57.69 /usr/bin/java -Xmx1024M -Xms1024M -jar minecraft_server.1.6.2.jar nogui root 112 0.8 0.1 2578388 11288 ?? S 29Aug13 163:51.23 /usr/local/libexec/fdbserver --cluster_file /usr/local/etc/foundationdb/fdb.cluster --datadir /usr/local/foundationdb/data/4689 --listen_address public --logdir /usr/local/foundationdb/logs --public_address auto:4689 sam 893 0.7 1.9 4552420 160864 ?? S 29Aug13 94:55.05 /Applications/Messages.app/Contents/MacOS/Messages -psn_0_426088 sam 64078 0.7 7.7 4593496 644468 ?? S 6:57PM 38:54.53 /Applications/Cardea-IU-130.1179.app/Contents/MacOS/idea -psn_0_22984170 sam 1045 0.7 0.9 1107568 72240 ?? S 29Aug13 38:39.75 /Applications/Google Chrome.app/Contents/Versions/31.0.1612.2/Google Chrome Helper.app/Contents/MacOS/Google Chrome Helper --type=gpu-process --channel=896.0.929728292 --supports-dual-gpus=false --gpu-driver-bug-workarounds=0,11,13,14,17,18 --disable-accelerated-video-decode --gpu-vendor-id=0x1002 --gpu-device-id=0x6898 --gpu-driver-vendor --gpu-driver-version sam 896 0.6 1.5 1459116 127332 ?? S 29Aug13 94:39.25 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome -psn_0_438379 root 114 0.6 0.1 2576672 8364 ?? S 29Aug13 112:27.21 /usr/local/libexec/fdbserver --cluster_file /usr/local/etc/foundationdb/fdb.cluster --datadir /usr/local/foundationdb/data/4691 --listen_address public --logdir /usr/local/foundationdb/logs --public_address auto:4691 root 113 0.6 0.1 2588500 11368 ?? S 29Aug13 131:31.92 /usr/local/libexec/fdbserver --cluster_file /usr/local/etc/foundationdb/fdb.cluster --datadir /usr/local/foundationdb/data/4690 --listen_address public --logdir /usr/local/foundationdb/logs --public_address auto:4690 ``` -------------------------------- ### HTML Template with Mustache Variables Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html An example of an HTML file structured to be used with Mustache.java. It includes placeholders like {{name}} that will be replaced with data provided during the rendering process. This is typical for generating dynamic web content. ```HTML Mustache Example

Hello, {{name}}!

This is a dynamic page generated using Mustache.java.

``` -------------------------------- ### Panel Controller Initialization Source: https://github.com/spullara/mustache.java/blob/main/benchmarks/src/main/resources/Yahoo.html Initializes the panel controller with configuration, store, and view objects. It also sets up references to DOM elements like the panel parent and badge nodes. ```JavaScript function b(a, c, d) { f(this, b); var e = this; e._store = c; e._view = d; e._config = a; var g = e._config.panel; e._panelParentNode = document.querySelector(g.parentSelector); e._badgeNode = e._config.badge.selector && document.querySelector(e._config.badge.selector); e._indicatorNode = g.indicatorSelector && document.querySelector(g.indicatorSelector); } ``` -------------------------------- ### Running the SSH Daemon with Dependencies Source: https://github.com/spullara/mustache.java/blob/main/compiler/src/test/resources/psauxwww.txt This snippet shows the command to launch the `SshDaemon` from the Mustache.java project. It includes a comprehensive classpath with various Java libraries and specifies application properties such as name, PID, repository, and home directory, along with the API endpoint. ```bash java -Xmx1024m -cp "/spullara/mustache.java/javax.inject/1/javax.inject-1.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/ocpsoft/prettytime/prettytime/2.1.2.Final/prettytime-2.1.2.Final.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/io/netty/netty-handler/4.0.0.CR9/netty-handler-4.0.0.CR9.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/io/netty/netty-buffer/4.0.0.CR9/netty-buffer-4.0.0.CR9.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/io/netty/netty-common/4.0.0.CR9/netty-common-4.0.0.CR9.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/io/netty/netty-transport/4.0.0.CR9/netty-transport-4.0.0.CR9.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/io/netty/netty-codec/4.0.0.CR9/netty-codec-4.0.0.CR9.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/sunnylabs/graphitehead/0.1-SNAPSHOT/graphitehead-0.1-SNAPSHOT.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/github/spullara/cli-parser/cli-parser/1.1.1/cli-parser-1.1.1.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/sunnylabs/metricsreporter/0.1-SNAPSHOT/metricsreporter-0.1-SNAPSHOT.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/sunnylabs/serviceclient/0.1-SNAPSHOT/serviceclient-0.1-SNAPSHOT.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/sunnylabs/configregistry/0.1-SNAPSHOT/configregistry-0.1-SNAPSHOT.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/101tec/zkclient/0.2/zkclient-0.2.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/log4j/log4j/1.2.16/log4j-1.2.16.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/apache/zookeeper/zookeeper/3.3.4/zookeeper-3.3.4.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/yammer/metrics/metrics-core/2.2.0/metrics-core-2.2.0.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/google/guava/guava/14.0.1/guava-14.0.1.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/slf4j/slf4j-simple/1.7.2/slf4j-simple-1.7.2.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/slf4j/slf4j-ext/1.7.2/slf4j-ext-1.7.2.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/ch/qos/cal10n/cal10n-api/0.7.4/cal10n-api-0.7.4.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/jboss/resteasy/resteasy-jaxrs/2.3.5.Final/resteasy-jaxrs-2.3.5.Final.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/javax/activation/activation/1.1/activation-1.1.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/commons-io/commons-io/2.1/commons-io-2.1.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/codehaus/jackson/jackson-jaxrs/1.9.11/jackson-jaxrs-1.9.11.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/codehaus/jackson/jackson-core-asl/1.9.9/jackson-core-asl-1.9.9.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/codehaus/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/jboss/resteasy/resteasy-jackson-provider/2.3.5.Final/resteasy-jackson-provider-2.3.5.Final.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/apache/httpcomponents/httpclient/4.2.3/httpclient-4.2.3.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/org/apache/httpcomponents/httpcore/4.2.3/httpcore-4.2.3.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/commons-codec/commons-codec/1.8/commons-codec-1.8.jar:/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo/com/sunnylabs/ssh-daemon/0.1-SNAPSHOT/ssh-daemon-0.1-SNAPSHOT.jar" -Dapp.name=dshell -Dapp.pid=1881 -Dapp.repo=/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT/repo -Dapp.home=/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT -Dbasedir=/Users/sam/Projects/sunnylabs/ssh-daemon-0.1-SNAPSHOT com.sunnylabs.dshell.daemon.SshDaemon -h http://stg.sunnylabs.com/api/ ``` -------------------------------- ### Execute Mustache Template with a Map Scope (Java) Source: https://github.com/spullara/mustache.java/blob/main/README.md Illustrates an alternative method for providing data to a Mustache template by using a `HashMap`. This example compiles a template directly from a string and executes it with a map containing 'name' and 'feature' data. ```java import java.util.HashMap; import java.io.StringReader; import java.io.OutputStreamWriter; import java.io.Writer; // ... (assuming Feature class is defined elsewhere or imported) public static void main(String[] args) throws IOException { HashMap scopes = new HashMap(); scopes.put("name", "Mustache"); scopes.put("feature", new Feature("Perfect!")); Writer writer = new OutputStreamWriter(System.out); MustacheFactory mf = new DefaultMustacheFactory(); Mustache mustache = mf.compile(new StringReader("{{name}}, {{feature.description}}!"), "example"); mustache.execute(writer, scopes); writer.flush(); } ```