Skip to content

Instantly share code, notes, and snippets.

View ntotten's full-sized avatar

Nathan Totten ntotten

View GitHub Profile
router.post('/change-password', middlewares.updateUserProfile, (req, res, next) => {
if (req.user.identities[0].isSocial) {
return sendError(400, 'Cannot update social account', next);
}
if (req.body.password !== req.body.confirm) {
return sendError(400, 'Password mismatch', next);
}
return auth0Utils.validatePassword(req.user, req.body.current)
@ntotten
ntotten / Create.cs
Last active December 15, 2016 08:44
Windows Azure Table Storage Tip
var account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
CloudTableClient.CreateTablesFromModel(
typeof(TableServiceContext),
account.TableEndpoint.AbsoluteUri,
account.Credentials);
@ntotten
ntotten / ExternalLoginConfirmation.cs.html
Last active December 13, 2016 14:46
Implementing a Simple Registration Code Check in ASP.NET MVC
<li class="name">
@Html.LabelFor(m => m.UserName)
@Html.TextBoxFor(m => m.UserName)
@Html.ValidationMessageFor(m => m.UserName)
</li>
<li class="name">
@Html.LabelFor(m => m.RegistrationCode)
@Html.TextBoxFor(m => m.RegistrationCode)
@Html.ValidationMessageFor(m => m.RegistrationCode)
</li>
const VARIBALES = {
lock_url: 'https://foo.com',
manage_url: 'https://manage.foo.com', // these come from env variables on the server
account: {
client_id: '{{CLIENT_ID}}',
client_secret: '{{CLIENT_SECRET}}'
},
...
}
@import url(https://fonts.googleapis.com/css?family=PT+Sans:400,700);
body, .wufoo, .wufoo label.desc, .wufoo legend.desc, .wufoo .info h2, .wufoo .info div, .wufoo input.text, .wufoo textarea.textarea, .wufoo input.file, .wufoo li div, .wufoo li span, .wufoo li div label, .wufoo li span label, .likert caption, .likert thead td, .likert tbody th label, .wufoo .section h3, .wufoo .section div, .paging-context {
font-family: "PT Sans", "Helvetica", Helvetica, Arial, sans-serif
}
#logo {
background-color: #008CBA
}
.wufoo .info h2 {
font-size: 180%
}
var lsr = require('lsr');
var path = require('path');
var fs = require('fs');
var toMarkdown = require('to-markdown');
var striptags = require('striptags');
var mkdirp = require('mkdirp');
var matter = require('gray-matter');
var toTitleCase = require('titlecase');
var beautifyHtml = require('js-beautify').html;
var lsr = require('lsr');
var path = require('path');
var fs = require('fs');
var matter = require('gray-matter');
var moment = require('moment');
var files = [];
function loadPath(loadPath) {
var resolvedPath = path.resolve(__dirname, loadPath);
bundles.UseCdn = true;
BundleTable.EnableOptimizations = true;
var jquery = new ScriptBundle("~/bundles/jquery", "//ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.1.min.js")
.Include("~/Scripts/jquery-{version}.js");
jquery.CdnFallbackExpression = "window.jQuery";
bundles.Add(jquery);
@ntotten
ntotten / app.js
Last active December 15, 2015 20:49
Scaling Out Socket.IO with Windows Azure Service Bus
// Setup the Service Bus store for Socket.IO
var sbstore = require('socket.io-servicebus');
io.configure(function () {
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 30);
io.set('store', new sbstore({
topic: nconf.get("SERVICE_BUS_TOPIC"),
connectionString: nconf.get("CUSTOMCONNSTR_SERVICEBUS"),
logger: io.get('logger')
}));
public FacebookClient(string appSecret, string appId)
{
SendAnalytics();
}
private static bool AnaltyicsSent = false;
private static object AnalyticsLock = new object();
private void SendAnalytics()
{