Skip to content

Instantly share code, notes, and snippets.

View mgroves's full-sized avatar

Matthew D. Groves mgroves

View GitHub Profile
@mgroves
mgroves / EnhancedDurability.cs
Created June 22, 2016 15:34
EnhancedDurability
config.BucketConfigs = new Dictionary<string, BucketConfiguration> {
{
"travel-sample", new BucketConfiguration
{
UseEnhancedDurability = true
}
}
};
@mgroves
mgroves / AtPlusExample.cs
Created June 22, 2016 15:33
AtPlusExample
private static void AtPlusExample()
{
Console.WriteLine("========= AtPlus");
// get the current count
var result1 = _bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Initial count: {result1.airportCount}");
// insert a new airport
@mgroves
mgroves / RequestPlusExample.cs
Created June 22, 2016 15:32
RequestPlusExample
private static void RequestPlusExample()
{
Console.WriteLine("========= RequestPlus");
// get the current count
var result1 =
_bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Initial count: {result1.airportCount}");
@mgroves
mgroves / NotBoundedExample.cs
Created June 22, 2016 15:28
NotBoundedExample
private static void NotBoundedExample()
{
Console.WriteLine("========= NonBounded (default)");
// get the current count
var result1 =
_bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Initial count: {result1.airportCount}");
// insert a new airport
using System;
using System.Data.SQLite;
using System.Linq;
using System.Transactions;
using Dapper;
using LinkCrawler.Models;
namespace LinkCrawler.Utils.Outputs
{
public class SqliteOutput : IOutput
$(document).ready(function () {
var commentDiv = $("#latestComments");
if (!commentDiv || commentDiv.length <= 0)
return;
var url = "https://disqus.com/api/3.0/forums/listPosts.json?forum=[your forum name]&limit=10&related=thread&order=desc&api_key=[put your own API key here]";
$.get(url, function (res, code) {
var html = "";
@model List<CommentViewModel>
@{
Layout = null;
}
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
@mgroves
mgroves / regexhelp.js
Last active September 15, 2015 21:14
function replaceASingleCharacter(str, singleCharacter, replaceWith) {
// put regex replace here
// something like return str.replace(/blahblahregex/,replaceWith);
}
var result1 = replaceASingleCharacter("This X should be replaced","X","Y");
if(result1 != "This Y should be replaced") {
console.log("fail 1");
}
using System;
using Android.Content;
using Newtonsoft.Json;
namespace LBMobileX
{
public static class IntentExtensions
{
/// <summary>
/// Serializes an object into the intent
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css">
<link href="jquery.tagit.css" rel="stylesheet" type="text/css">
</head>
<body>
<p>This geotag demo uses the <strong>jQuery tag-it</strong> control and <strong>Google's AutocompleteService API</strong>.</p>