Skip to content

Instantly share code, notes, and snippets.

@elpete
elpete / BaseIntegrationSpec.cfc
Last active October 16, 2019 15:55
Swaps out WireBox mappings for corresponding mocks during a callback.
component {
/**
* Swaps out WireBox mappings for corresponding mocks during a callback.
* mappings = { "apiClient" = mockApiClient }
*/
function whileSwapped( struct mappings = {}, any callback, boolean verifyMappingExists = true ) {
var binder = getWireBox().getBinder();
var originalMappings = {};
mappings.each( function( mapping, component ) {
@elpete
elpete / AddEngineToTravisBuild.cfc
Last active July 18, 2018 14:59
Update all .travis.yml files for a given user to have a new engine in the matrix
/**
* Description of task
*/
component {
property name="wirebox" inject="wirebox";
function run(
string searchQuery,
string newEngine,
@elpete
elpete / cloudSettings
Last active November 20, 2019 05:12
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-11-20T05:12:09.109Z","extensionVersion":"v3.4.3"}
@elpete
elpete / App.vue
Created September 6, 2017 14:57
Nested scoped slots in Vue templates
<template>
<manage-lists v-model="items">
<template scope="{ item: user }">
{{ user.firstName }} {{ user.lastName }}
</template>
</manage-lists>
</template>
<script>
export default {
@elpete
elpete / App.vue
Last active October 15, 2020 12:51
v-model binding for custom components and special input types
<template>
<div>
<radio-set
v-model="selectedValue"
:options="options"
></radio-set>
<select-box
v-model="selectedValue"
:options="options"
></select-box>
@elpete
elpete / UsersHandler.cfc
Last active May 9, 2017 12:54
Snapshot Testing in TestBox
component {
function index( event, rc, prc ) {
var criteria = event.valueExists( "active" ) ? { active = rc.active } : {};
var users = getInstance( "User" ).findAllWhere( criteria )
.map( function( user ) {
return user.getMemento();
} );
event.renderData( data = users, format = "json" );
}
@elpete
elpete / ColdBox.cfc
Last active April 28, 2017 15:59
A simple function to correctly escape values for Vue props in CFML (example integration with ColdBox)
// config/ColdBox.cfc
component {
function configure() {
coldbox.viewsHelper = "includes/helpers/ViewHelper.cfm"
}
}
@elpete
elpete / GitHub.sh
Created April 21, 2017 15:50
Open a github repo from the command line
alias github=GitHub
function GitHub() {
if [ ! -d .git ] ; then
echo "ERROR: This isn't a git directory" && return false;
fi
git_url=`git config --get remote.origin.url`
if [[ $git_url == git@github.com* ]] ; then
@elpete
elpete / Binder.cfc
Created March 8, 2017 15:42
WireBox Clear Mapping
<!--- clearMapping --->
<cffunction name="clearMapping" output="false" access="public" returntype="any" hint="Clear a mapping by name if it exists" colddoc:generic="struct">
<cfargument name="name" required="true" hint="The name of the mapping to retrieve"/>
<cfset structDelete( instance.mappings, name ) />
<cfreturn this>
</cffunction>
<!--- Usage --->
<!--- <cfset application.wirebox.getBinder().clearMapping( "mappingName" ) /> --->
@elpete
elpete / Lucee Extensions in Docker on Startup.txt
Last active February 17, 2017 15:09 — forked from anonymous/docker-log.txt
Lucee Extensions in Docker on Startup
2017-02-17T09:37:44Z @guustnieuwenhuis @ are the lucee environment variables implemented in the docker images?
2017-02-17T09:38:07Z @bdw429s @guustnieuwenhuis Can you explain what you mean?
2017-02-17T09:38:59Z @guustnieuwenhuis lucee has environment vraiebles like `lucee.preserve.case` %28full list: <https://docs.google.com/spreadsheets/d/10s-nn_FsoSD_RiLwjYZICacCoC386SjkEGT3pOfBJVU/edit#gid=0>%29
2017-02-17T09:39:36Z @guustnieuwenhuis I’m wondering if I can set `lucee.preserve.case` in my docker compose file
2017-02-17T09:40:05Z @guustnieuwenhuis like with `SMTP_SERVER` for example
2017-02-17T09:40:22Z @bdw429s Funny, I was about to post about a few of those. I don%27t know enough about Docker, but I assume you can set whatever props you want when starting the container.
2017-02-17T09:47:09Z @bdw429s So a quick note to everyone who was talking to me about how to install Extensions the other day. Micha reminded me of some java system properties that managed to not make it into the docs anywhere. One of th