Skip to content

Instantly share code, notes, and snippets.

View ntotten's full-sized avatar

Nathan Totten ntotten

View GitHub Profile
@ntotten
ntotten / server.js
Created August 5, 2012 20:02
Simple Cron Task in Windows Azure Web Sites
app.get('/crontask', function(req, res) {
var sender = new SendGrid.SendGrid('user','key');
sender.send({
to: '[email protected]',
from: '[email protected]',
subject: 'test mail',
text: 'This is a sample email message.'
});
});
@ntotten
ntotten / AccountController.cs
Created August 6, 2012 03:00
Facebook Apps and Windows Azure Web Sites (Part 1 – Getting Started)
public class AccountController : Controller
{
//
// GET: /Account/Login
public ActionResult Login()
{
// Build the Return URI form the Request Url
var redirectUri = new UriBuilder(Request.Url);
redirectUri.Path = Url.Action("FbAuth", "Account");
@ntotten
ntotten / server.js
Created August 30, 2012 20:13
Using Node.js on Windows Azure as a WebSocket server for Windows 8 Store Apps
var WebSocketServer = require('ws').Server
, wss = new WebSocketServer({port: process.env.PORT});
wss.on('connection', function(ws) {
ws.on('message', function(message) {
console.log('received: %s', message);
});
ws.send('something');
});
@ntotten
ntotten / events.js
Created October 7, 2012 03:54
Building Super Fast Web Apps with PJAX
$('a.pjax').pjax('#main')
$('#main')
.on('pjax:start', function() { $('#loading').show() })
.on('pjax:end', function() { $('#loading').hide() })
@ntotten
ntotten / page.xaml
Created October 7, 2012 03:57
UPDATED: Breaking Change with Facebook C# SDK Authentication on Windows Phone
<phone:WebBrowser x:Name="webBrowser1" IsScriptEnabled="True"></phone:WebBrowser>
@ntotten
ntotten / auth.js
Created October 7, 2012 04:00
Facebook jQuery Helper
$(document).ready(function() {
// Add the function to run after FB is initialized
$(document).on('fb:initialized', function() {
FB.getLoginStatus(fbAuthStatusChange);
});
$(document).fb('youappid');
});
function fbAuthStatusChange(request) {
// Do something
@ntotten
ntotten / Location.cs
Created October 24, 2012 19:02
.Net 4.5 on Windows Azure Web Sites
public class Location {
public int Id { get; set; }
public string Name { get; set; }
public DbGeography Coordinates { get; set; }
}
@ntotten
ntotten / AccountController.FacebookCallback1.cs
Last active April 10, 2020 03:18
Facebook Authentication with the Facebook C# SDK and ASP.NET MVC 4
public ActionResult FacebookCallback(string code)
{
var fb = new FacebookClient();
dynamic result = fb.Post("oauth/access_token", new
{
client_id = "your_app_id_here",
client_secret = "your_app_secret_here",
redirect_uri = RedirectUri.AbsoluteUri,
code = code
});
@ntotten
ntotten / wp-config.php
Created December 20, 2012 20:54
Hosting Multiple Wordpress Sites for Free on Windows Azure
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp2_';
@ntotten
ntotten / deploy.cmd
Last active December 11, 2015 00:08
Static Site Generation with DocPad on Windows Azure Web Sites
:: 3. Build DocPad Site
echo Building the DocPad site
pushd %DEPLOYMENT_TARGET%
call %DEPLOYMENT_TARGET%\node_modules\.bin\docpad.cmd generate
IF !ERRORLEVEL! NEQ 0 goto error