As part of an exercise in figuring out how to derive the continuous equation that is sampled by a discrete function, I went ahead and opened my Numerical Methods textbook and started going through the Newton-Raphson Method. This, plus my first ever tweet storm are the output.
This file contains 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
require 'dry/monads/all' | |
include Dry::Monads::Result::Mixin | |
success = Success(:finished) | |
def merge(result, failures) | |
result | |
.or { |failure| Failure(failure + failures) } | |
.bind { Failure(failures) } |
This uses the excellent benchmark-ips
library by Evan Phoenix. You'll have to install that with:
gem install benchmark-ips
To do the Rails comparisons, you'll need to be within a Rails environment. The easiest thing would be to save the benchmark script into a Rails project, make sure benchmark-ips
is in your Gemfile, and then enter a rails c
environment. In the console, enter:
This file contains 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
#!/usr/bin/env ruby | |
# gem install benchmark-ips benchmark-memory | |
# ruby benchmark.rb | |
require "benchmark/ips" | |
require "benchmark/memory" | |
Benchmark.ips do |x| | |
x.report("join") do |
I hereby claim:
- I am michaelherold on github.
- I am michaeljherold (https://keybase.io/michaeljherold) on keybase.
- I have a public key ASC2imTPK_PBmFPtZknSKzIW-Dm8pqH3Bws2DiYaWE99Uwo
To claim this, I am signing this object:
This file contains 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
#!/usr/bin/env ruby | |
hits = [] | |
checks = { | |
#'_spec\.rb$' => ['focus:[:space:]*true'], | |
'\.rb$' => ['binding\.pry', 'debugger'] | |
} | |
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified | |
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n") |
This file contains 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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
This file contains 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
Unhandled rejection TypeError: Cannot read property 'toString' of null | |
at defaultKey (/home/herold/code/project/node_modules/gulp-cache/index.js:17:39) | |
at objectAssign._getFileKey (/home/herold/code/project/node_modules/gulp-cache/lib/TaskProxy.js:56:32) | |
at objectAssign._checkForCachedValue (/home/herold/code/project/node_modules/gulp-cache/lib/TaskProxy.js:68:21) | |
at objectAssign.processFile (/home/herold/code/project/node_modules/gulp-cache/lib/TaskProxy.js:24:21) | |
at DestroyableTransform._transform (/home/herold/code/project/node_modules/gulp-cache/index.js:83:19) | |
at DestroyableTransform.Transform._read (/home/herold/code/project/node_modules/gulp-cache/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10) | |
at DestroyableTransform.Transform._write (/home/herold/code/project/node_modules/gulp-cache/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12) | |
at doWrite (/home/herold/code/project/node_modules/gulp-cache/node_mo |
This file contains 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
ruby-2.0.0 (main)> client = Twitter::REST::Client.new do |config| | |
config.consumer_key = <snip>, | |
config.consumer_secret = <snip> | |
end | |
=> #<Twitter::REST::Client:0x0000000749a370> | |
ruby-2.0.0 (main)> tweet = client.status(381940500032258049) | |
=> #<Twitter::Tweet:0x00000007752770> | |
ruby-2.0.0 (main)> uri = Twitter::Entity::URI.new(tweet.attrs[:entities][:urls][0]) | |
=> #<Twitter::Entity::URI:0x00000007061808> | |
ruby-2.0.0 (main)> uri.display_url |
This file contains 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
#!/bin/sh | |
# This amazing little snippet saved me so much time | |
# Sourced from http://askubuntu.com/questions/85641 | |
sudo apt-get clean | |
cd /var/lib/apt | |
sudo mv lists lists.old | |
sudo mkdir -p lists/partial | |
sudo apt-get clean | |
sudo apt-get update |
NewerOlder