Skip to content

Instantly share code, notes, and snippets.

View jamesmanning's full-sized avatar

James Manning jamesmanning

View GitHub Profile
@jamesmanning
jamesmanning / GetDatabaseInfo.linq.cs
Last active January 15, 2024 03:54
LINQPad script to get basic schema information about the currently selected database (assumes LINQPad's default data context creation method)
void Main()
{
var databaseInfo = GetDatabaseInfo(this);
databaseInfo.Dump();
}
// Define other methods and classes here
public class DatabaseInfo
{
public Type DataContextType { get; set; }
@jamesmanning
jamesmanning / Program.cs
Created May 6, 2012 12:32
simple TCP client and server
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
@jamesmanning
jamesmanning / sp_generate_inserts2.sql
Created June 22, 2012 18:14
slightly better version of sp_generate_inserts
SET NOCOUNT ON
GO
PRINT 'Using Master database'
USE master
GO
PRINT 'Checking for the existence of this procedure'
IF (SELECT OBJECT_ID('sp_generate_inserts','P')) IS NOT NULL --means, the procedure already exists
BEGIN
// from https://pastebin.com/6pAYrAM2
/*
toggle video visability & remove until next video
taken from /v4c/ and hardly modified
*/
$('nav.navbar a[href="#"][onclick]').attr("href", "javascript:void(0)");
if (!$('a[onclick*="removeUntilNext"]').length) {
$('a[onclick*="removeVideo"]').parent().parent().append($("<li>").append($("<a>").attr("href", "javascript:void(0)").attr("onclick", "javascript:removeUntilNext()").text("Remove Video Until Next")))
}
function removeUntilNext() {

Keybase proof

I hereby claim:

  • I am jamesmanning on github.
  • I am jamesmanning (https://keybase.io/jamesmanning) on keybase.
  • I have a public key ASD4uH_4gcdviwzB8KYjGe7OKPV1q5S3P4nOJHdRrRzzxQo

To claim this, I am signing this object:

// NOTE: Firefox doesn't add async/await support until version 52. Stable is version 50 currently as of this writing.
// step 1: open the BPM extension's 'options' page
// step 2: open chrome devtools console. On Windows and Linux: Ctrl + Shift + J. On Mac: Cmd + Option + J.
// step 3: copy-paste the below code. Make sure to hit enter after pasting so that it runs
// step 4: close and re-open the BPM options page, scroll down to the bottom to see the list of custom CSS subreddits to confirm it now includes the berrymotes ones
// NOTE: because of a message handler that runs inside BPM that's expecting this to run inside the context of a
// particular message, there will be an error shown in the console after this runs, but ***IT CAN BE SAFELY IGNORED***.
// It will look something like this:
//
######
## NOTE: the contents of this file should be pasted into a powershell console or sourced
#
# (new-object Net.WebClient).DownloadString("https://raw.github.com/jamesmanning/DevMisc/master/env-setup/profile.ps1") | iex
######
# powershell location for WinXP
# http://www.microsoft.com/en-us/download/details.aspx?id=16818
# powershell prereq 2.0 SP1 for WinXP
# http://go.microsoft.com/fwlink/?linkid=153680
public static class Extensions
{
public static Dictionary<TKeyOuter, Dictionary<TKeyMiddle, Dictionary<TKeyInner, TValue>>> ToThreeLevelDictionary<TKeyOuter, TKeyMiddle, TKeyInner, TValue, TInput>(
this IEnumerable<TInput> input,
Func<TInput, TKeyOuter> outerKeySelector,
Func<TInput, TKeyMiddle> middleKeySelector,
Func<TInput, TKeyInner> innerKeySelector,
Func<TInput, TValue> valueSelector)
{
return input
This file has been truncated, but you can view the full file.
var berryEmotes=[{"background-image":"http://a.thumbs.redditmedia.com/-UJ20dLxrm_8r4kr.png","tags":["lyra"],"sr":"marmemotes","height":140,"width":126,"names":["welliwashungryandwhenyoucravehands"],"apng_url":"http://backstage.berrytube.tv/marminator/images/a/-UJ20dLxrm_8r4kr.png"},{"background-image":"http://a.thumbs.redditmedia.com/1ERLWojxsUO7nFQT.png","tags":["luna",""],"sr":"marmemotes","height":140,"width":121,"names":["doodoodooluna"],"apng_url":"http://backstage.berrytube.tv/marminator/images/a/1ERLWojxsUO7nFQT.png"},{"background-image":"http://a.thumbs.redditmedia.com/84ozl2WMmiYp6Euf.png","tags":["oc",""],"sr":"marmemotes","height":140,"width":200,"names":["ivyrage","ierage"],"apng_url":"http://backstage.berrytube.tv/marminator/images/a/84ozl2WMmiYp6Euf.png"},{"background-image":"http://a.thumbs.redditmedia.com/E1FnMA0PMGL9qnwx.png","tags":["oc","berrytube"],"sr":"marmemotes","height":140,"width":118,"names":["keystrokeguitar"],"apng_url":"http://backstage.berrytube.tv/marminator/images/a/E1FnMA0PMG
@jamesmanning
jamesmanning / Program.cs
Created April 19, 2013 19:03
using exception.ToString - sync code
using System;
using System.IO;
using System.Threading;
namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{