This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // NSBezierPath+Ops.m | |
| // Grids | |
| // | |
| // Created by Michael Fogleman on 12/2/14. | |
| // Copyright (c) 2014 Michael Fogleman. All rights reserved. | |
| // | |
| #import "NSBezierPath+Ops.h" | |
| #import "SkPath.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def load_blocks(path): | |
| height = {} | |
| with open(path, 'r') as fp: | |
| for line in fp: | |
| x, y, z = map(int, line.strip().split('|')) | |
| height[(x, z)] = max(y, height.get((x, z), 0)) | |
| return height | |
| def main(): | |
| height = load_blocks('blocks.txt') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from builder import * | |
| from world import * | |
| from time import sleep | |
| def mountain(x, y, z, w, radius, height, noise): | |
| client = get_client() | |
| set_block = client.set_block | |
| set_blocks = client.set_blocks | |
| for dx in range(-radius * 2, radius * 2 + 1): | |
| for dz in range(-radius * 2, radius * 2 + 1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package pt | |
| import ( | |
| "math" | |
| "math/rand" | |
| ) | |
| type poissonGrid struct { | |
| r, size float64 | |
| cells map[Vector]Vector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import operator | |
| def merge(dicts): | |
| result = {} | |
| keys = reduce(operator.or_, [set(d) for d in dicts]) | |
| for key in keys: | |
| values = [d[key] for d in dicts if key in d] | |
| result[key] = tuple(reduce(operator.add, x) for x in zip(*values)) | |
| return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import requests | |
| import sys | |
| HEADERS = {'content-type': 'application/json'} | |
| class Fabmo(object): | |
| def __init__(self, host, port=9876): | |
| self.url = 'http://%s:%s' % (host, port) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "github.com/go-gl/gl/v2.1/gl" | |
| "github.com/go-gl/glfw/v3.1/glfw" | |
| "github.com/ungerik/go-cairo" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module pill() { | |
| difference() { | |
| hull() { | |
| sphere(10, $fn=36); | |
| translate([40, 0, 0]) | |
| sphere(10, $fn=36); | |
| } | |
| translate([0, 0, 14]) | |
| hull() { | |
| sphere(5, $fn=36); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import turtle | |
| def turn(i): | |
| left = (((i & -i) << 1) & i) != 0 | |
| return 'L' if left else 'R' | |
| def curve(iteration): | |
| return ''.join([turn(i + 1) for i in range(2 ** iteration - 1)]) | |
| if __name__ == '__main__': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bisect | |
| import math | |
| import random | |
| import time | |
| import wx | |
| FONT = 'Courier' | |
| MAX_SECONDS = 60 * 10 | |
| class Panel(wx.Panel): |