Skip to content

Instantly share code, notes, and snippets.

View ryanvalentin's full-sized avatar

Ryan Valentin ryanvalentin

View GitHub Profile
@ryanvalentin
ryanvalentin / disqus-wp-webview.cs
Last active March 1, 2023 16:52
Using Disqus in a WebBrowser control in Windows
// Url of Comments page
private string CommentsUri = "http://yoursite.com/comments/your_static_comments_page.html?"
+ "shortname=" + "YOUR_SHORTNAME"
+ "&url=" + HttpUtility.UrlEncode("ORIGINAL_ARTICLE_URL")
+ "&title=" + HttpUtility.UrlEncode("ORIGINAL_ARTICLE_TITLE")
+ "&identifier=" + HttpUtility.UrlEncode("ORIGINAL_ARTICLE_IDENTIFIER");
private void Browser_Loaded(object sender, RoutedEventArgs e)
{
Browser.IsScriptEnabled = true; // Make sure javascript is enabled
@ryanvalentin
ryanvalentin / blogger-ident.html
Last active December 25, 2015 20:09
Get identifier from Blogger and output as 'disqus_identifier'
<div id="disqus_thread" onresize="setHeight()"></div>
<script type="text/javascript">
// Blog variables
var blog;
var msg = new gadgets.MiniMessage(__MODULE_ID__);
var prefs = new gadgets.Prefs();
// Disqus variables
var disqus_shortname = prefs.getString("shortname");
@ryanvalentin
ryanvalentin / threads_set.cs
Last active January 2, 2016 21:09
How to make a Disqus API call to threads/set to get an unsorted array of threads you specified
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace Example
@ryanvalentin
ryanvalentin / authbrowser.cs
Last active January 3, 2016 04:19
How to include social auth and user registration layers in Disqus OAuth grants
using Microsoft.Phone.Controls;
using Microsoft.Phone.Info;
using System;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
@ryanvalentin
ryanvalentin / threads_listPopular.cs
Last active January 4, 2016 06:59
Get Disqus popular threads using C#
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace Example
@ryanvalentin
ryanvalentin / disqus-azure-pt1.js
Last active August 29, 2015 14:05
Disqus Azure Mobile Service callback function Pt 1
// Disqus API public key
var apiPublic = 'YOUR_PUBLIC_KEY';
// Disqus API secret key
var apiSecret = 'YOUR_SECRET_KEY';
// Should match exactly what you've entered in your Disqus API application
var oAuthRedirectUri = 'https://MOBILE_SERVICE_NAME.azure-mobile.net/api/disqus_callback/';
exports.get = function(request, response) {
// Disqus API public key
var apiPublic = 'YOUR_PUBLIC_KEY';
// Disqus API secret key
var apiSecret = 'YOUR_SECRET_KEY';
// Should match exactly what you've entered in your Disqus API application
var oAuthRedirectUri = 'https://MOBILE_SERVICE_NAME.azure-mobile.net/api/disqus_callback/';
exports.get = function(request, response) {
// Disqus API public key
var apiPublic = 'YOUR_PUBLIC_KEY';
// Disqus API secret key
var apiSecret = 'YOUR_SECRET_KEY';
// Should match exactly what you've entered in your Disqus API application
var oAuthRedirectUri = 'https://MOBILE_SERVICE_NAME.azure-mobile.net/api/disqus_callback/';
// Master key from your mobile service configuration
@ryanvalentin
ryanvalentin / lumiadevices.cs
Last active August 29, 2015 14:14
Lumia device name dictionary
private static readonly Dictionary<string, string> _deviceMap = new Dictionary<string, string>
{
{ "ACCORD", "HTC 8X" },
{ "H883G", "Huawei W1" },
{ "MOBILE", "Cherry Mobile Alpha Luxe" },
{ "P4301", "Lumia 920" },
{ "P5122", "Lumia 620" },
{ "P5174", "Lumia 820" },
{ "P5217", "Lumia 1020" },
{ "P5238", "Unknown Lumia (P5238)"},
using System;
using System.Text;
namespace Disqus.Core.Api.Models
{
public sealed class DsqWordpressIdentifier
{
public DsqWordpressIdentifier(long wordpressId, Uri siteUrl)
{
this.WordpressId = wordpressId;