Skip to content

Instantly share code, notes, and snippets.

Eric Peterson elpete

  • Salt Lake City, UT
View GitHub Profile
@elpete
elpete / BaseIntegrationSpec.cfc
Last active Oct 16, 2019
Swaps out WireBox mappings for corresponding mocks during a callback.
View BaseIntegrationSpec.cfc
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 Jul 18, 2018
Update all .travis.yml files for a given user to have a new engine in the matrix
View AddEngineToTravisBuild.cfc
/**
* Description of task
*/
component {
property name="wirebox" inject="wirebox";
function run(
string searchQuery,
string newEngine,
@elpete
elpete / cloudSettings
Last active Nov 20, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-11-20T05:12:09.109Z","extensionVersion":"v3.4.3"}
@elpete
elpete / App.vue
Created Sep 6, 2017
Nested scoped slots in Vue templates
View App.vue
<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 Aug 25, 2017
v-model binding for custom components and special input types
View App.vue
<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
Snapshot Testing in TestBox
View UsersHandler.cfc
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 Apr 28, 2017
A simple function to correctly escape values for Vue props in CFML (example integration with ColdBox)
View ColdBox.cfc
// config/ColdBox.cfc
component {
function configure() {
coldbox.viewsHelper = "includes/helpers/ViewHelper.cfm"
}
}
@elpete
elpete / GitHub.sh
Created Apr 21, 2017
Open a github repo from the command line
View GitHub.sh
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 Mar 8, 2017
WireBox Clear Mapping
View Binder.cfc
<!--- 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 Feb 17, 2017 — forked from anonymous/docker-log.txt
Lucee Extensions in Docker on Startup
View Lucee Extensions in Docker on Startup.txt
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
You can’t perform that action at this time.