Skip to content

Instantly share code, notes, and snippets.

View cp's full-sized avatar
:shipit:

Colby Aley cp

:shipit:
View GitHub Profile
@cp
cp / gist:6f50fb52d3dfbb388060
Created December 9, 2014 22:44
java stack implimentation
class Stack {
private Object[] array;
private int tos = -1;
private int size;
Stack(int size) {
this.size = size;
array = new Object[size];
}
@cp
cp / overrides.md
Last active April 28, 2016 17:53
Reflect Overrides

Reflect Overrides

We built overrides as a way of customizing individual components at runtime. This can be useful for dynamically altering a component based on it's current environment.

Overrides use JSONPath to manipulate your view's configuration. The documentation on JSONPath's syntax can be found here.

Here's an example of supplying Reflect.js with overrides. Specifically, we're setting the dimensions of a component with id #1.

var ui = new ReflectUI(token),

overrides = [

/*jshint node:true*/
'use strict';
module.exports = function(/* environment, appConfig */) {
return {
reflect: {
css: '...'
}
};
};

Keybase proof

I hereby claim:

  • I am cp on github.
  • I am colby (https://keybase.io/colby) on keybase.
  • I have a public key whose fingerprint is AE96 399D B2B3 6EB7 AF4D B83C 8B58 5716 F9E2 ECB0

To claim this, I am signing this object:

@cp
cp / machine.js
Last active June 29, 2022 18:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@cp
cp / crop.rb
Created January 15, 2025 17:59
require "rmagick"
crop = [
0.46277403831481934, # x_min (proportion from left)
0.5259760022163391, # y_min (proportion from top)
0.36609894037246704, # x_max (proportion from left)
0.4222343862056732, # y_max (proportion from top)
]
input_path = "./input.jpeg"
@cp
cp / crop.rb
Created January 15, 2025 18:59
require "rmagick"
crop = [
0.46558651328086853, # x1 (proportion from left)
0.471098929643631, # x2 (proportion from left)
0.5287885069847107, # y1 (proportion from top)
0.5272343754768372, # y2 (proportion from top)
]
input_path = "./input.jpeg"