Skip to content

Instantly share code, notes, and snippets.

View rc1's full-sized avatar

Ross Cairns rc1

View GitHub Profile
@rc1
rc1 / ToggleImageEffect.cs
Created March 8, 2016 13:40
Unity Workshop Toggle Image Effect
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityStandardAssets.ImageEffects;
public class ToggleImageEffect : MonoBehaviour {
public Toggle toggle;
private ImageEffectBase imageEffect;
@rc1
rc1 / ToggleImageEffect
Created March 8, 2016 13:40
Unity Workshop
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityStandardAssets.ImageEffects;
public class ToggleImageEffect : MonoBehaviour {
public Toggle toggle;
private ImageEffectBase imageEffect;
@rc1
rc1 / gist:b55f691b2a3366048e39
Created March 8, 2016 13:38
Unity Workshop Light Toggler
using UnityEngine;
using System.Collections;
public class LightToggler : MonoBehaviour {
[RangeAttribute(0.01f, 20.0f)]
public float toggleEvery = 1;
private float _lastToggle;
// Use this for initialization
@rc1
rc1 / bash_tricks
Last active February 8, 2016 14:03 — forked from stefandz/bash_tricks
Prompt config for iTerm
alias show_files='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hide_files='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias cls='clear'
alias tracert='traceroute'
alias lsusb='system_profiler SPUSBDataType'
alias server_here='sudo python -m SimpleHTTPServer 80'
alias git_orphan='git checkout --orphan'
alias ssh-nocheck='ssh -o UserKnownHostsFile=/dev/null'
alias subl='open -a /Applications/Sublime\ Text.app/'
@rc1
rc1 / example.cpp
Created January 27, 2016 12:10
Variable capture / closures in C++11
#include <functional>
#include <string>
#include <vector>
int main () {
std::string name;
std::vector<std::function<void(void)>> fns;
@rc1
rc1 / example.cpp
Created January 27, 2016 12:10
Variable capture / closures in C++11
#include <functional>
#include <string>
#include <vector>
int main () {
std::string name;
std::vector<std::function<void(void)>> fns;
@rc1
rc1 / Node Red Wiring Pi RPi2.md
Last active April 29, 2022 09:33
Wiring-pi for Node-Red on Raspberry Pi 2 (July 2015)

Installing the wiring-pi module for node-red on Raspberry Pi 2

July 2015

Note: the wiring-pi module for node.js is bindings around the c wiring-pi SDK, and not the same as wiring-pi

Step 1

Locate the node-red root folder (where settings.js is). You can use locate if it is installed

@rc1
rc1 / app.js
Last active August 29, 2015 14:23
Touch & Speak: Bare Conductive's TouchBoard with Bacon.js
// Touch Board Example
// ===================
// Connects to a touch board and 'says' a word when a touch is detecte
// Modules
// =======
var serialPort = require( 'serialport' );
var Bacon = require( 'baconjs' );
var W = require( 'w-js' );
var say = require( 'say' );
@rc1
rc1 / gist:b556844e290997b447e4
Last active August 29, 2015 14:22
Simple Promise System
// A most simple promise system, to explain promises
var p = promise( function ( resolve, reject ) {
// do async stuff here
fs.readFile( function ( err, file ) {
if ( err ) {
reject( new Error( 'it mucked up' ) );
} else {
resolve( file );
}
@rc1
rc1 / ThreadedCin.cpp
Created April 29, 2015 17:39
Non-blocking stdin reading in openFrameworks
#include "ThreadedCin.h"
#pragma mark - Lifecycle
ThreadedCin::ThreadedCin () {
latest = "";
}
ThreadedCin::~ThreadedCin () {
stopThread();