Skip to content

Instantly share code, notes, and snippets.

@dgg
dgg / ComplexFeature.cs
Created July 15, 2015 11:16
Switching Fun. Complex feature
public class Optional : NancyModule
{
public Optional()
{
new Features.Optional()
.TryActivate(this, _ =>
View["Optional"]);
}
}
@dgg
dgg / _navigation.cshtml
Created July 15, 2015 11:16
Switching Fun. Navigation
<section class="top-bar-section">
<!-- Left Nav Section -->
<ul class="left">
<li class='@Html.ActiveFor("Home")'><a href="/">Home</a></li>
@if (Feature<Optional>.Is().Enabled)
{
<li class='@Html.ActiveFor("Optional")'><a href="/optional">Optional Feature</a></li>
}
</ul>
</section>
@dgg
dgg / Startup.cs
Created July 15, 2015 11:15
Switching Fun. Startup
public class Startup
{
public void Configuration(IAppBuilder app)
{
FeatureSwitcher.Configuration.Features.Are
.ConfiguredBy.AppConfig().And
.NamedBy.TypeName();
app.UseNancy();
}
@dgg
dgg / Features.config.xml
Created July 15, 2015 11:14
Switching Fun. Features config
<?xml version="1.0"?>
<features>
<feature name="Optional" enabled="false"/>
</features>
@dgg
dgg / web.config.xml
Created July 15, 2015 11:13
Switching Fun. web config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!--...-->
<sectionGroup name="featureSwitcher" type="FeatureSwitcher.Configuration.SectionGroup, FeatureSwitcher.Configuration">
<section name="default" type="FeatureSwitcher.Configuration.DefaultSection, FeatureSwitcher.Configuration"/>
<section name="features" type="FeatureSwitcher.Configuration.FeaturesSection, FeatureSwitcher.Configuration"/>
</sectionGroup>
</configSections>
<!--..-->
@dgg
dgg / SimpleFeature.cs
Created July 15, 2015 11:11
Switching Fun. Simple feature
public class Optional : IFeature { }
@dgg
dgg / ComplexFeature.cs
Last active August 29, 2015 14:24
Switching Fun
public class Optional : NancyModule
{
public Optional()
{
new Features.Optional()
.TryActivate(this, _ =>
View["Optional"]);
}
}
@dgg
dgg / cmd.sh
Created June 26, 2015 09:18
Gulp PGP IV. cmd
> gulp build --env=stage
> gulp deploy --env=stage --platform=ios
@dgg
dgg / deploy.js
Created June 26, 2015 09:16
Gulp PGP IV. deploy
gulp.task('deploy', function (done) {
var platform = config.ensure.platform(argv.platform);
var env = config.ensure.environment(argv.env, argv.debugmode);
if (env === 'prod' && platform === 'ios') {
throw 'ios applications cannot be distributed via HockeyApp';
}
var endpoint = '/apps/' + config.phoneGap.appId;
@dgg
dgg / build.js
Created June 22, 2015 13:07
Gulp PGP III. build
gulp.task('build', gulpsync.sync(['unlock', 'compress']), function () {
var endpoint = '/apps/' + config.phoneGap.appId;
var env = config.ensure.environment(argv.env, argv.debugmode);
pgBuild.auth({ token: config.phoneGap.authToken }, function (e, api) {
gulp.src('tmp/*.zip').pipe(tap(function (file, t) {
var options = {
form: {
data: {