Skip to content

Instantly share code, notes, and snippets.

@Spaider
Spaider / gist:0106d62ac3af821021fd
Created February 23, 2015 11:14
RSVP with more than one Event
match (r:RSVP)-[rr:RSVP_RACE]->(race:Race)
with r, count(race) as cnt
where cnt > 1
return id(r), cnt
@Spaider
Spaider / ProfileHealthCheck.sql
Last active August 29, 2015 14:11
Athlinks profile health check
DECLARE @login nVARCHAR(50)
SET @login = ''
SET NOCOUNT ON
IF @login = ''
BEGIN
RAISERROR ('Please define @login', 18, 1)
RETURN
@Spaider
Spaider / Neo4jHealthCheck.cyp
Created December 9, 2014 12:04
List of health-check queries for neo4j
// Number of Athletes (info)
match (:Athlete)
return count(*)
// Number of Courses (info)
match (:Course)
return count(*)
// Number of Races (info)
match (:Race)
@Spaider
Spaider / program.cs
Created June 17, 2014 12:24
Simple template-base generator
using System;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication2
{
class Program
{
@Spaider
Spaider / TaskThrottle.cs
Created May 5, 2014 14:37
Task throttling using TAP and .NET v4.5
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace ProducerConsumerTest
{
class Program
{
private const int MAX_CONCURRENCY_LEVEL = 5;
private const int NUM_PAGES = 20;
Begin
Declare @aiRacerID Int
Declare @row Int
Declare @page Int = 1
Declare @pageSize Int = 10000
Set Nocount On
Declare spCursor Cursor fast_forward
For
@Spaider
Spaider / Load on scroll
Created February 5, 2014 21:11
Load content on scroll
var loading = false;
$(window).scroll(function(){
if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){
if(loading == false){
loading = true;
$('#loadingbar').css("display","block");
$.get("load.php?start="+$('#loaded_max').val(), function(loaded){
$('body').append(loaded);
$('#loaded_max').val(parseInt($('#loaded_max').val())+50);
$('#loadingbar').css("display","none");
@Spaider
Spaider / UpdateProfileEmail.sql
Created May 17, 2013 14:19
Updates membership email from email in racer details.
Declare @oldEmail Varchar(100) = '<specify old email here>'
Declare @newEmail Varchar(100)
Declare @racerID Int
Declare @userId Uniqueidentifier
Set @userId = (Select am.UserId From aspnet_Membership am Where am.Email Like @oldEmail)
Print 'User ID: ' + Cast(@userId As Varchar(45))
Set @racerID = (
@Spaider
Spaider / DataAccessSample-01.cs
Created February 22, 2013 09:04
Shows how to work with DB instances in custom data accessors.
/// <summary>
/// Accessor for working with Stuff
/// </summary>
public static class SampleDataAccessor
{
/// <summary>
/// This overload opens DB connection and thus, manages DB state.
/// Wrapping creation in using clause ensures that it will be
/// properly disposed
/// </summary>
@Spaider
Spaider / klavogonki-ru.user.js
Last active December 13, 2015 16:48
Auto-start open races on Klavogonki.ru
// ==UserScript==
// @name KlavogonkiAutoStart
// @namespace klavogonki.ru
// @version 0.0.2.0
// @description Auto start open races on Klavogonki.Ru site
// @author Spaider
// @grant none
// @include http://klavogonki.ru/*
// ==/UserScript==