Skip to content

Instantly share code, notes, and snippets.

View steventroughtonsmith's full-sized avatar

Steven Troughton-Smith steventroughtonsmith

View GitHub Profile
@steventroughtonsmith
steventroughtonsmith / json
Created August 8, 2012 20:30
Using Twitter from ComputerCraft
-----------------------------------------------------------------------------
-- JSON4Lua: JSON encoding / decoding support for the Lua language.
-- json Module.
-- Author: Craig Mason-Jones
-- Homepage: http://json.luaforge.net/
-- Version: 0.9.40
-- This module is released under the MIT License (MIT).
-- Please see LICENCE.txt for details.
--
-- USAGE:
@steventroughtonsmith
steventroughtonsmith / json
Created August 10, 2012 13:24
ComputerCraft Twitter Search
-----------------------------------------------------------------------------
-- JSON4Lua: JSON encoding / decoding support for the Lua language.
-- json Module.
-- Author: Craig Mason-Jones
-- Homepage: http://json.luaforge.net/
-- Version: 0.9.40
-- This module is released under the MIT License (MIT).
-- Please see LICENCE.txt for details.
--
-- USAGE:
@steventroughtonsmith
steventroughtonsmith / stillalive-rpc8e.c
Created August 18, 2012 01:47
Still Alive written in C for the RPC8/e 65el02 CPU in Minecraft
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <peekpoke.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
@steventroughtonsmith
steventroughtonsmith / gist:6763213
Created September 30, 2013 12:39
Non-opaque application windows in iOS 7, with optional blur. Shows the user's wallpaper under the app, with Parallax if supported.
typedef enum _UIBackgroundStyle {
UIBackgroundStyleDefault,
UIBackgroundStyleTransparent,
UIBackgroundStyleLightBlur,
UIBackgroundStyleDarkBlur,
UIBackgroundStyleDarkTranslucent
} UIBackgroundStyle;
@interface UIApplication (UIBackgroundStyle)
-(void)_setBackgroundStyle:(UIBackgroundStyle)style;
@steventroughtonsmith
steventroughtonsmith / HWKViewController.m
Last active May 31, 2020 23:55
Example of dynamic iOS UI that changes based on the connection/disconnection of a hardware keyboard, based on suggestions from @JohnRHeaton. Requires linking to private GraphicsServices framework. rdar://problem/15447952
//
// HWKViewController.m
// HardwareKeyboardUI
//
// Created by Steven Troughton-Smith on 13/11/2013.
// Copyright (c) 2013 High Caffeine Content. All rights reserved.
//
#import "HWKViewController.h"
@steventroughtonsmith
steventroughtonsmith / gist:7515380
Last active April 2, 2019 01:38
iOS 7 UIKeyCommand keydown/keyup and keycode input implementation for a UIResponder. Private API, of course…
-(BOOL)canBecomeFirstResponder
{
return YES;
}
-(UIKeyCommand *)_keyCommandForEvent:(UIEvent *)event // UIPhysicalKeyboardEvent
{
NSLog(@"keyCommandForEvent: %@\n\
type = %i\n\
keycode = %@\n\
@steventroughtonsmith
steventroughtonsmith / ToonyPolymer.shader
Last active March 15, 2019 21:56
Toon-based plasticky Unity3D shader
// Plasticky Unity3D shader
// Based on built-in Toon/Lighted
Shader "Custom/ToonyPolymer" {
Properties {
_Color ("Main Color", Color) = (0.5,0.5,0.5,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_Ramp ("Toon Ramp (RGB)", 2D) = "gray" {}
_Shininess ("Shininess", Range (0.1, 1)) = 0.7
_Intensity ("Intensity", Range (0.1, 5.0)) = 1.0
@steventroughtonsmith
steventroughtonsmith / modlist
Last active August 29, 2015 14:01
HCC2 1.0.8
mods:
AM2_1.1.2b.zip
AdditionalPipes2.6.0-BC4.2.1.jar
AdvancedMachines_1.6.4.zip
AdvancedPowerManagement-1.2.85-IC2-1.118.jar
AnimationAPI v1.1.2 mc1.6.4.zip
ArchimedesShips.zip
Atomic-Science-1.1.0.49-core.jar
BetterDungeons207.zip
[mcp] Activating mod mcp
[FML] Activating mod FML
[Forge] Activating mod Forge
[CodeChickenCore] Activating mod CodeChickenCore
[Micdoodlecore] Activating mod Micdoodlecore
[MobiusCore] Activating mod MobiusCore
[NotEnoughItems] Activating mod NotEnoughItems
[PowerCrystalsCore] Activating mod PowerCrystalsCore
[TConstruct-Preloader] Activating mod TConstruct-Preloader
[AppliedEnergistics-Core] Activating mod AppliedEnergistics-Core
@interface UIWindow (resize)
-(void)_adjustSizeClassesAndResizeWindowToFrame:(CGRect)frame;
@end
typedef enum _UICustomRes
{
UICustomResiPadTwoThirds,
UICustomResiPadHalf,
UICustomResiPadOneThird,
UICustomResiPhone47,