- Some utilities:
sudo apt-get install vim tmux git
- Copy/paste from the command line:
sudo apt-get install xclip
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/ | |
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work, | |
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.) | |
function colorTemperatureToRGB(kelvin){ | |
var temp = kelvin / 100; |
var createGame = require('voxel-engine') | |
function sphereWorld(x, y, z) { | |
// return the index of the material you want to show up | |
// 0 is air | |
if (x*x + y*y + z*z > 15*15) return 0 | |
return 3 | |
} | |
var game = createGame({ |
var createGame = require('voxel-engine') | |
function sphereWorld(x, y, z) { | |
// return the index of the material you want to show up | |
// 0 is air | |
if (x*x + y*y + z*z > 15*15) return 0 | |
return 3 | |
} | |
var game = createGame({ |
var createEngine = require('voxel-engine') | |
var game = createEngine({ | |
generate: function(x, y, z) { | |
if (x*x + y*y + z*z > 20*20) return 0; | |
return Math.floor(Math.random() * 4) + 1; | |
}, | |
texturePath: './', | |
materials: [ 'dirt', 'grass', 'crate', 'brick' ] | |
}); | |
game.appendTo('#container'); |
class Scene | |
attr_accessor :lights, :objects, :camera | |
def initialize | |
@lights = [] | |
@objects = [] | |
end | |
def add_light light | |
@lights.push light | |
end |
class STL | |
class Writer | |
attr_accessor :tris, :size | |
def initialize tris | |
@tris = tris | |
@size = tris.length*50 + 80 + 4 | |
end | |
def write_stl_header f | |
80.times {|n| f << [0].pack("C") } #uint8 |
// QUESTION: For some reason Devise only sees auth token when passed through url not as param | |
// WHY? this seems really insecure... | |
-(NSString *) concatURL { | |
NSString *base = @"http://localhost:3000"; | |
NSString *auth = [[NSUserDefaults standardUserDefaults] objectForKey:@"token"]; | |
return [NSString stringWithFormat:@"%@?auth_token=%@", base, auth]; | |
} | |
-(NSDictionary *) postListing { |
+(NSMutableArray *) loadRemoteListings { | |
NSMutableArray *listings = [NSMutableArray arrayWithCapacity:20]; | |
NSURL *url = [[NSURL alloc] initWithString:@"http://localhost:3000"]; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
NSURLResponse *response; | |
NSError *error; |
+(NSMutableArray *) loadRemoteListings { | |
NSMutableArray *listings = [NSMutableArray arrayWithCapacity:20]; | |
NSURL *url = [[NSURL alloc] initWithString:@"http://localhost:3000"]; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
NSURLResponse *response; | |
NSError *error; |