Skip to content

Instantly share code, notes, and snippets.

View tniezurawski's full-sized avatar

Tomek Nieżurawski tniezurawski

View GitHub Profile
@tniezurawski
tniezurawski / ff-enabling-feature-good.js
Last active June 16, 2021 10:27
An example of good practice when it comes to creating feature flags that enables features
function getPrice(object) {
if (variation('release-apply-discount')) {
return object.newPrice;
}
return object.oldPrice;
}
@tniezurawski
tniezurawski / ff-disabling-feature-bad.js
Created June 16, 2021 10:23
An example of bad practice when it comes to creating feature flags that disables features
function getPrice(object) {
if (variation('release-no-discount')) {
return object.oldPrice;
}
return object.newPrice;
}
@tniezurawski
tniezurawski / ff-mixing-with-app-logic-good.js
Created April 19, 2021 07:52
An example of good practice when it comes to mixing feature flags with application logic
if (variation('release-cool-stuff') {
if (!foo || !bar) {
// do something amazing
}
}
@tniezurawski
tniezurawski / ff-mixing-with-app-logic-bad.js
Last active April 19, 2021 07:52
An example of bad practice when it comes to mixing feature flags with application logic
if (variation('release-cool-stuff') && (!foo || !bar)) {
// do something amazing
}
@tniezurawski
tniezurawski / close-mirage.js
Last active June 19, 2018 12:50
ember-test never terminates with COVERAGE=true
// tests/helpers/close-mirage.js
export function closeMirage(hooks) {
hooks.afterEach(function () {
if (window.server) { // close Mirage Server if present
window.server.shutdown();
}
});
}
@tniezurawski
tniezurawski / controllers.application.js
Created February 12, 2017 10:38
Request with queryParams
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@tniezurawski
tniezurawski / git showfiles
Created August 23, 2014 17:33
git showfiles - show names of files in last local commit
#!/bin/bash
# show names of files in last local commit
# using 'git showfiles'
git config --global alias.showfiles 'show --pretty="format:" --name-only'