Skip to content

Instantly share code, notes, and snippets.

@ebidel
ebidel / es6-meta-programming.js
Last active May 23, 2018 13:02
"ES6 meta programming" using tagged template strings
// ES6 meta programming ???
// The more complex form of ES6 template strings are called
// "tagged" template strings. In short, they allow you to
// pass the final evaluated string to a function for further
// processing. This allows for some interesting things. For example:
//
// get`https://api.github.com/repos/${org}/${repo}/issues?sort=${sort}`;
//
// _could_ make a network request and return a Promise with the result
@idosela
idosela / http-response-interceptor.js
Last active February 25, 2024 12:51
Sample code for ng-conf 2014
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;
@jbrunemann
jbrunemann / Application.cfc
Last active December 16, 2015 01:09
Work around for ColdFusion 10.0 Bug 3327626: Another CacheManager with same name '_ORM_........' already exists in the same VM.
<cfscript>
component
{
public void function onError(required any exception, string eventName) output=true
{
if (structKeyExists(arguments.exception, "type") and arguments.exception.type eq "net.sf.ehcache.CacheException" and structKeyExists(arguments.exception, "message") and arguments.exception.message contains "Another CacheManager with same name")
{
var cacheMan_obj = createObject("java", "net.sf.ehcache.CacheManager").getCacheManager("_ORM_" & this.name);
cacheMan_obj.shutdown();
}