Ways of computing the value of Pi in Python (Pithon. geddit?)
Featuring:
- Gregory-Leibniz series
- Nilakantha's series
math.pi(this counts, right?)- possibly more in the future
| var chain = function(nodes, func) { | |
| for (var i = 0; i < nodes.length - 1; i++) { | |
| func(nodes[i], nodes[i + 1]); | |
| } | |
| }; | |
| /** | |
| * example: | |
| * chain([source, filter, gain, output], function(a, b) { | |
| * a.connect(b); |
| /** | |
| * Send HTTP requests using XMLHttpRequest | |
| * @param {string} url The url to which to send the request | |
| * @param {object} options Configuration like verb and parameters | |
| * @param {function} callback The function to run after a response is received | |
| * @returns undefined | |
| * @example | |
| * xhr("http://example.com/api/endpoint", { params: { hello: "world", tau: "2pi" } }, function(res, headers) { doStuff(); } ); | |
| */ |
| path = require "path" | |
| atom.workspace.observeTextEditors (editor) -> | |
| if path.extname(editor.getPath()) is ".dart" | |
| editor.setTabLength(2) | |
| console.log "set tab length to 2", editor | |
| else | |
| tabLength = atom.config.get "editor.tabLength" || 4 | |
| editor.setTabLength(tabLength) | |
| console.log "set tab length to " + tabLength, editor |
Ways of computing the value of Pi in Python (Pithon. geddit?)
Featuring:
math.pi (this counts, right?)| var arachnid = {}; | |
| arachnid.init = function(elems, callback) { | |
| var a = { | |
| callback: (typeof callback === "function" ? callback : function(e) { console.log(e) }), | |
| elems: [] | |
| }; | |
| var sectionHistory = [null, null]; |
| HTMLElement.prototype.animateBase = HTMLElement.prototype.animate; | |
| HTMLElement.prototype.animate = function(keyframes, options) { | |
| function isNothing(thing) { | |
| return thing === null || typeof thing === "undefined"; | |
| } | |
| var elem = this; | |
| var opts = { |
| * { | |
| font-family: inherit; | |
| } | |
| ._2fug { | |
| background-image: url(https://storage.googleapis.com/material-icons/external-assets/v1/icons/svg/ic_settings_white_24px.svg); | |
| background-position: center; | |
| } | |
| ._2sdm * { |
| #!/usr/bin/env python3 | |
| import sys | |
| import getpass | |
| templates_dir = "/home/{user}/Templates/".format( user=getpass.getuser() ) | |
| arg = sys.argv[1] | |
| output_filename = sys.argv[1] |
| var shrinkDimensions = function(a, b, m) { | |
| if (a * b > m) { | |
| var k = a/b; // a = bk , b = a/k | |
| var A, B; | |
| // let ab = m | |
| // b^2 * k = m | |
| // b^2 = m/k | |
| B = Math.sqrt(m/k); | |
| // a = bk | |
| A = B * k; |
| #!/usr/bin/env python3 | |
| import sys | |
| import urllib.request | |
| import urllib.parse | |
| from bs4 import BeautifulSoup | |
| request_url = "http://www.canyouseeme.org/" | |
| request_data = urllib.parse.urlencode({ "port": sys.argv[1] }).encode("utf-8") |