Skip to content

Instantly share code, notes, and snippets.

View rc1's full-sized avatar

Ross Cairns rc1

View GitHub Profile
1948447748
2986689877
9660869883
9660869883
9660869883
B947E88A51BD0F3A886E546966DF3A735901D3DCF32AE4E5181E467D4450687488D6985FBCFD05BFBA112862AE422E7E1FE7EADA2025E94ED91F56F15BCA501B
@rc1
rc1 / reactive-property.js
Last active June 23, 2017 17:01
UniRx's Reactive Property for JavaScript/RxJS
import { Subject } from 'rxjs/Subject';
import { Subscription } from 'rxjs/Subscription';
import { Observable } from 'rxjs/Observable';
export class ReactiveProperty extends Subject {
constructor( v ) {
super();
var value = v;
this.notifyOnSubscribe = arguments.length > 0;
@rc1
rc1 / peek.js
Last active July 3, 2017 13:44
Peek content below the fold using jquery
// Peak content from below the fold above the fold
var defaultPeekAmount = 80;
$( '[data-peek]' )
// Find the closest
.sort( ( a, b ) => {
if( a.getBoundingClientRect().top - $( window ).height() < b.getBoundingClientRect().top - $( window ).height() + $( window ).scrollTop() ) {
return -1;
} else {
return 1;
@rc1
rc1 / PointLightsImageEffect.cs
Created March 7, 2017 16:21
Unity Point Lights as Image Effect
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class PointLightsImageEffect : MonoBehaviour {
private Camera _camera;
public Material EffectMaterial;
@rc1
rc1 / DataLoader.cs
Last active January 25, 2017 10:16
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
public class DataLoader : MonoBehaviour {
// Filename (make sure it is in a folder called "Resources" so Unity includes it in the build)
@rc1
rc1 / gulpfile.js
Last active September 4, 2018 01:23
A single gulpfile which can be configured via run scripts. Puts configuration over code, contradicting the goal of gulp. But handy when you need to do the same thing over and over again quickly.
// Modules
// =======
//
// gulp gulp-plumber gulp-concat gulp-if gulp-rename gulp-sourcemaps browser-sync gulp-csso gulp-less gulp-autoprefixer gulp-uglify gulp-babel babel-preset-es2015 gulp-jade git://github.com/oroce/gulp-jade-php#v2.0.0-0 gulp-sass
// Gulp
// ----
var gulp = require( 'gulp' );
var gulpif = require( 'gulp-if' );
var concat = require( 'gulp-concat' );

Make cyclists like myself fear for their lives on the stunning A82. Bench dine at Oban's Seafood Shack. Try catch the Vatersay Boys on Bara or at least visit vatersay's beaches or catch a fishing boat to Mingulay or watch planes land at the worlds only airport who "scheduled flights use a beach as the runway". Dodge otters on the many Hebridean causeways and drive past rugged mountains dressed in pristine white sanded beaches. Walk to a Gatliff. Catch the chessmen in Uig. Sleep, read books and drive north from Ullapool's Ceilidh place. Have a fear of heights here. See true nothingness and catch the [The

@rc1
rc1 / lut.frag
Created March 24, 2016 10:34
LUT Shader for Three.js for loading .cube files generate from Da Vinci resolve.
uniform sampler2D tDiffuse;
uniform sampler2D tLut;
uniform int lutSize;
uniform bool isEnabled;
varying vec2 vUv;
// Ref: http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#No_3D_Texture_support
vec4 sampleAs3DTexture( sampler2D tex, vec3 texCoord, float size ) {
float sliceSize = 1.0 / size; // space of 1 slice
float slicePixelSize = sliceSize / size; // space of 1 pixel
@rc1
rc1 / LightToggler.cs
Created March 8, 2016 13:42
LightToggler
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