Skip to content

Instantly share code, notes, and snippets.

View ecto's full-sized avatar
🙂
building things

Cam Pedersen ecto

🙂
building things
View GitHub Profile
@ecto
ecto / maybe_exit.sh
Last active September 15, 2016 17:51
~ :q 10:50 AM
Your shell has no parents. Are you sure you want to exit? (y/n)n
@ecto
ecto / gist:59a9738ee7e5c1a81a02
Created April 7, 2015 14:42
Use of Weapons - Iain Banks
“Can’t machines build these faster?” he asked the woman, looking around the starship shell.
“Why, of course!” she laughed.
“Then why do you do it?”
“It’s fun. You see one of these big mothers sail out those doors for the first time, heading for deep space, three hundred people on board, everything working, the Mind quite happy, and you think; I helped build that. The fact a machine could have done it faster doesn’t alter the fact that it was you who actually did it.”
“Hmm,” he said.
@ecto
ecto / SKLabelButton.h
Created November 19, 2014 01:20
Quick SKLabelNode-based button for Sprite Kit
#import <SpriteKit/SpriteKit.h>
@interface SKLabelButton : SKLabelNode
@property (copy, nonatomic) void (^callback)();
@property (strong, nonatomic) UIColor *mainColor;
@property (strong, nonatomic) UIColor *highlightColor;
@property (nonatomic) bool touchWasCancelled;
+(instancetype)initWithCallback:(void (^)())callback;
function Ticker () {
var ticks = 0;
this.tick = function () {
ticks++;
}
this.getTicks = funtion () {
return ticks;
}
@ecto
ecto / keybase.md
Last active August 29, 2015 13:58

Keybase proof

I hereby claim:

  • I am ecto on github.
  • I am ecto (https://keybase.io/ecto) on keybase.
  • I have a public key whose fingerprint is C9A6 38A8 27EE F66E D42F 7A87 EC1B F1D8 EC90 E15A

To claim this, I am signing this object:

void setup () {
delay(1000);
Keyboard.begin();
// give the computer time to recognize a new keyboard
// this should be a bunch of escape presses though
delay(10000);
openProgram("terminal");
payload();
// function
// Constructor
// object { function, function }
var isomerize = function () {
if (arguments.length == 1) {
var code = arguments[0];
if (typeof code == 'function') {
return new LocalFunctionIsomer(code);
@ecto
ecto / gravity.js
Created November 23, 2013 23:35
calculate single-object effect on spacetime plane (with three.js PlaneGeometry)
var G = 100;
var vertex;
for (var i = 0; i < plane.geometry.vertices.length; i++) {
vertex = plane.geometry.vertices[i];
var distance = Math.sqrt(Math.pow(vertex.x - sphere.position.x, 2) + Math.pow(vertex.y - -sphere.position.z, 2));
var f = -(G * sphere.mass) / Math.pow(distance, 2);
vertex.z = f;
}
@ecto
ecto / snake.js
Last active December 28, 2015 22:59

Snake in your terminal!

Still needs score, losing state, and collision detection for walls.

If you have node installed, you can do this to play:

curl -Lo snake.js http://bit.ly/1jo72pa
#make sure you got the right file:
cat snake.js
@ecto
ecto / gist:7324775
Last active December 27, 2015 12:19
~ → cat testConnection.js
var net = require('net');
var url = require('url');
// edit this
var conString = 'tcp://crypton_test_user:crypton_test_user_password@localhost:5432/crypton_test'; // default
var config = parse(conString);
console.log(config);