View tacit.py
# # Exaple: | |
# ```py | |
# from tacit import * | |
# | |
# @fn | |
# def f(x, y): | |
# return 2 * (x + y) | |
# | |
# @fn | |
# def g(x): return x + 3 |
View simp-deps.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View init
init |
View basic_ruby.rb
def f x; x**2 + 2*x + 1; end | |
def integrate sym, a, b | |
dx = 0.001 | |
fn = method sym | |
dx * (a..b - dx).step(dx).map(&fn).sum | |
end | |
puts integrate :f, 2, 4 |
View 7.rb
REDACT = %w{ k m v w x z } | |
longest = Array.new | |
def valid? word | |
(REDACT & (word.split '')).empty? | |
end | |
words = (File.read 'words.txt').split /\s/ | |
words.each { |word| longest = word unless word.size <= longest.size || !(valid? word) } |
View perlin.js
/* | |
* By: josephg - https://github.com/josephg | |
* From: https://github.com/josephg/noisejs/blob/master/perlin.js | |
* Only slight modification from me, so it works as a module. | |
*/ | |
/* | |
* A speed-improved perlin and simplex noise algorithms for 2D. | |
* | |
* Based on example code by Stefan Gustavson (stegu@itn.liu.se). |
View brainfrog
#!/usr/bin/env ruby | |
$DEBUG = false | |
EOF = "\0" | |
String.class_eval { define_method(:arg?) { ARGV.include? self } } | |
ALLOC = '--alloc'.arg? ? ARGV[(ARGV.index '--alloc') + 1].to_i : 100 | |
PROGRAM = (File.read ARGV.select { |arg| File.file? arg }.first) + EOF |
View pronouns.rb
#!/usr/bin/env ruby | |
require 'rmagick' | |
include Magick | |
PRONOUN_DIR = File.expand_path './pronoun_images/' | |
def parse_pronouns file | |
raw = File.read File.expand_path file | |
raw.split("\n").map{ |line| line.split(/--|\//).map(&:strip) } |
View index.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/p5.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.dom.min.js"></script> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<script src="sketch.js"></script> |
NewerOlder