Skip to content

Instantly share code, notes, and snippets.

View tingham's full-sized avatar
💭
Making the world better by making my world worse.

Thomas Ingham tingham

💭
Making the world better by making my world worse.
View GitHub Profile
@tingham
tingham / Remove-SafeGit.ps1
Created November 17, 2023 14:02
Powershell (ps1) command to nuke git project root but retain dotfiles such as .git | .gitignore | .editorconfig
# Nukes all your guts out
Get-ChildItem -Path "*" -Recurse | Where-Object { $_.Name -cnotlike ".*" } | % { git rm -rf $_.FullName }
# Straightens up the jimmy-jabby
git clean -fxd
# Does the thingamabob
git reset
# Shows you what you have
Get-ChildItem -Attributes ReadOnly,Hidden,System,Directory,Archive
@tingham
tingham / msketch.js
Created September 4, 2019 20:00
A NodeJS script to generate a new Processing.org Sketch file
#!/usr/bin/env node
/*
* Execute to vim by running
* $vim `./msketch.js`
* or
* $vim `./msketch.js someName`
*
* Add this to your vimrc to execute a sketch using F5
* autocmd Filetype java nnoremap <F5> :w<CR> :!cd %:p:h && processing-java --sketch=$PWD/ --run <CR> %
int width = 512;
int height = 512;
void setup ()
{
size (width, height, P3D);
colorMode(HSB, 100);
}
void draw ()
<style type="text/css">
div.eventWrapper {
display:block;
float:left;
clear:none;
width: 320px;
}
div.eventWrapper div.titleSlug {
display:block;
clear:both;
@tingham
tingham / gist:6191156
Created August 9, 2013 04:16
Example of structuring your Processing sketch to avoid having to restart everything.
void setup ()
{
size(width, height, P3D);
thread("update");
}
void update ()
{
while (true) {
try {
@tingham
tingham / gist:1473032
Created December 13, 2011 17:29
npm Error 110 Debugging
// outbound nodejs test.
var http = require("http");
var options = {
host: "107.20.159.167",
port: 80,
path: "/",
method: "GET"
};
/*
* AppController.j
* AccTest
*
* Created by Thomas Ingham on May 17, 2010.
* Copyright 2010, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
+ (CPPopUpButton)themedSegmentedControl
{
var segmentedControl = [[CPSegmentedControl alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 25.0)];
[segmentedControl setTrackingMode:CPSegmentSwitchTrackingSelectAny];
[segmentedControl setSegmentCount:3];
[segmentedControl setWidth:40.0 forSegment:0];
[segmentedControl setLabel:@"foo" forSegment:0];
[segmentedControl setTag:1 forSegment:0];
2010-04-09 22:04:26.996 Cappuccino: Exception CPInvalidArgumentException: - [CPString _attributeWithName:forClass:] unrecognized selector sent to instance 0x0038bd in [<CPException 0x000nan> raise]
2010-04-09 22:04:26.998 Cappuccino: [<CPApplication 0x000a35> sendEvent:]
2010-04-09 22:04:26.999 Cappuccino: [<CPWindow 0x0025f6> sendEvent:]
2010-04-09 22:04:27.001 Cappuccino: [<CPTextField 0x002a95> performSelector:withObject:]
2010-04-09 22:04:27.002 Cappuccino: [<CPTextField 0x002a95> mouseUp:]
2010-04-09 22:04:27.004 Cappuccino: [<HPCollectionViewItem 0x002a6e> mouseUp:]
2010-04-09 22:04:27.005 Cappuccino: [<CPCollectionView 0x002963> performSelector:withObject:]
2010-04-09 22:04:27.006 Cappuccino: [<CPCollectionView 0x002963> mouseUp:]
2010-04-09 22:04:27.008 Cappuccino: [<HPIndexView 0x002807> collectionView:didDoubleClickOnItemAtIndex:]
2010-04-09 22:04:27.009 Cappuccino: [<CPNotificationCenter 0x0025b4> postNotification:]