Skip to content

Instantly share code, notes, and snippets.

View DanTup's full-sized avatar

Danny Tuppeny DanTup

  • Coded Consultants Ltd
  • England, UK
  • 14:31 (UTC +01:00)
  • X @DanTup
View GitHub Profile
@DanTup
DanTup / Setup
Last active March 30, 2016 20:35
PI_REPO="https://DanTup@github.com/DanTup/Pi.git"
# Danny's Pi Setup script
#
# This script is intended to be run from a newly set up Raspbian install. It just clones my
# (private) Pi repo which contains further scripts and executes them. It will prompt for a
# GitHub access key during the clone because the repo is private.
#
# Run with:
# bash <(curl -sSL https://gist.github.com/DanTup/bcdf20cb300e40c628e8/raw/Setup)
@DanTup
DanTup / delete_comments_likes.js
Last active October 17, 2023 21:51
Delete all Facebook posts for a year
// Only tested in Chrome...
// Must browse to "Your Comments" (or "Your Likes") page of activity feed, then pre-load the year you want to delete
// and as many comments as possible (scroll down, they load lazily).
//
// I ACCEPT ABSOLUTELY NO RESPONSIBILITY FOR THIS DOING BAD STUFF. THE NEXT FACEBOOK DEPLOYMENT
// COULD WELL BREAK THIS, OR MAKE IT DO THINGS YOU DO NOT EXPECT. USE IT AS A STARTING POINT ONLY!
//
// It will start failing once it gets to the end, just reload the page and kick it off again.
var rows = document.querySelectorAll('#year_2012 .pam._5shk');
<!DOCTYPE html>
<html>
<head>
<title>MySecondGame</title>
</head>
<body>
<canvas width="1024" height="768"></canvas>
<div style="display: none;">
<img id="img-player" src="assets/player.png" />
@DanTup
DanTup / simple_serialization_tests.dart
Created August 7, 2014 12:06 — forked from sethladd/simple_serialization_tests.dart
+ support for child objects (sorry if it's bad; written in Notepad and don't really know Dart!)
import 'dart:convert';
import 'package:smoke/smoke.dart' as smoke;
@MirrorsUsed(targets: const [SimpleWithMirrors, Simple], override: '*')
import 'dart:mirrors';
abstract class Serializable {
static fromJson(Type t, Map json) {
var typeMirror = reflectType(t);
T obj = typeMirror.newInstance(new Symbol(""), const[]).reflectee;
// A list of all event types; these are basically used as strings, because we can't(?)
// get a nice unique name from a TS Class to use for the event name
enum EventType {
SendTheStuff
};
// All events must at least give us the EventType that we can convert to a string
interface IEvent {
EventType: EventType;
};
@DanTup
DanTup / npm error
Created March 19, 2014 12:35
Error when trying to grab AngularJS from GitHub via NPM
PS M:\Coding\TestApps\AngularTest> npm install angular/angular.js --save-dev
npm ERR! git fetch -a origin (git://github.com/angular/angular.js) fatal: refs/remotes/origin/v1.0.x tracks both refs/heads/v1.0.x and refs/remotes/origin/v1.0.x
@DanTup
DanTup / PowerShellHere.reg
Created February 1, 2014 11:28
Creates "PowerShell Here" shortcuts on context menu for right-clicking folders, blank background space, blank background space in libraries. Preserves default PowerShell colours/settings.
Windows Registry Editor Version 5.00
; Creates "PowerShell Here" shortcuts on context menu for
;
; a) right-clicking on a folder
; b) right-clicking in the blank space when inside a folder (eg. already inside the folder)
; c) right-clicking in the blank space when inside a folder that's inside a library
;
; Uses cmd start to launch normal Powershell shortcut so that the normal PowerShell shortcut
; colours/settings are preserved (blue, not black/white)
let [<Given>] ``something`` () = ()
let [<Given>] ``something else`` () = ()
---
Scenario: TestStuff
Given something
and something else
----
@DanTup
DanTup / default.htm
Created July 9, 2013 15:24
Strange IE10 issue. In IE7/8/9 this code will throw an error (attributes["onchange"] returns null). But in IE10, magic happens, and attributes["onchange"] returns attributes["name"] and the code alerts the name of the element!
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
</head>
<frameset rows="70,*">
<frame src="about:blank">
<frameset cols="165,*">
<frame src="about:blank">
<frame src="settings.htm">
@DanTup
DanTup / LaunchKiln.ps1
Last active May 11, 2018 18:43
PowerShell function to launch Kiln in a browser for the repo you're currently in.
# Launch Kiln for current repo
Function Kiln
{
if (Test-Path ".\.hg\hgrc")
{
$repoUrl = (Select-String "default = (.*)" -Path ".\.hg\hgrc" -AllMatches).Matches.Groups[1].Value
Start $repoUrl
}
else
{ Write-Warning "Not in a repo!" }