Skip to content

Instantly share code, notes, and snippets.

View jamesmanning's full-sized avatar

James Manning jamesmanning

View GitHub Profile
// 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
@jamesmanning
jamesmanning / CreatePowerShellHereKeys.ps1
Last active November 21, 2015 21:44
Create the registry keys necessary to get 'Open PowerShell here' in Windows Explorer context menus
Set-StrictMode -Version Latest
# since this won't work without running with admin privs, check for those first
$wid=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$prp=new-object System.Security.Principal.WindowsPrincipal($wid)
$adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator
$IsAdmin=$prp.IsInRole($adm)
if ($IsAdmin -eq $false)
{
@jamesmanning
jamesmanning / simpleclass.js
Created August 30, 2014 00:12
simple class example
class Foo {
constructor(someCtorParam) {
this.someClassVar = someCtorParam;
}
someMethod() {
console.log('in some method: ' + this.someClassVar);
}
}
@jamesmanning
jamesmanning / Gruntfile.js
Created August 22, 2014 23:59
Gruntfile.js from default 'yo angular' generation
// Generated on 2014-08-22 using generator-angular 0.9.5
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
@jamesmanning
jamesmanning / contrived.cs
Created July 17, 2014 20:14
why empty list is better than null
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
This file has been truncated, but you can view the full file.
[{"em-text-transform":"uppercase","tags":["berrypunch","","new"],"em-height":"73px","em-overflow":"hidden","height":200,"em-width":"130px","names":["bpsign"],"em-position":"absolute","background-image":"http://a.thumbs.redditmedia.com/GJefDqUOKmm5aXNH.png","em-font-style":"normal","em-color":"#c25098","em-top":"8px","sr":"marmemotes2","em-font-size":"12px","em-font-weight":"bold","em-font-family":"\"arial\"","width":151,"em-left":"15px","background-position":["0px","-980px"],"em-text-align":"center"},{"background-image":"http://a.thumbs.redditmedia.com/-UJ20dLxrm_8r4kr.png","tags":["lyra"],"sr":"marmemotes","height":140,"width":126,"names":["welliwashungryandwhenyoucravehands"],"apng_url":"http://berrymotes.com/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://berrymotes.com/images/a/1ERLWojxsUO7nFQT.png"},{"background-image":"http://a.thumbs.reddi