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
## Author: Andrew Brown | |
## Created: 2014-02-11 | |
## Estimates cos using a Maclaurin series | |
function void = cosapprox (xrad, acceptable_error) | |
# Get true cos(xrad) value for error analysis | |
true_value = cos(xrad); | |
# Estimate value with Maclaurin series | |
term_index = 1; |
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
## Author: Andrew Brown | |
## Created: 2014-02-11 | |
## Estimates ln(x) with Taylor series | |
function void = taylor_log (x) | |
# Estimate value with Taylor series | |
approx = x - 1 | |
tic | |
for term_index = 1 : 100 | |
approx += ((-1)^term_index)*((x-1)^(term_index+1))/(term_index+1); |
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
// Create staggered JS events to handle the reading automagically | |
$.each(words, function (word_index, word) { | |
setTimeout(function () { | |
display_word(word, { | |
'left': left, | |
'pivot': center, | |
'right': right | |
}); | |
}, word_index * WORD_VISIBLE_TIME); | |
}); |
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
<html> | |
<head> | |
<title>FaS Reader</title> | |
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
// Fast as Sanic Reader | |
var left = $('<span />').attr('id', 'left'), |
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
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script> | |
function show_time() { | |
$('.clock').html(''); | |
$('.clock').css('text-align', 'center'); | |
$('body').css('overflow', 'hidden'); | |
var date = new Date(); |
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
eval(" | |
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
def method_missing x; "Hello World"; end; puts stup; dne; "dlroW olleH"; x gnissim_dohtem fed | |
def method_missing x | |
"Hello World" | |
end | |
puts stup | |
dne | |
"dlroW olleH" | |
x gnissim_dohtem fed |
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
$('div.answer_count_row.light_gray').filter(function (index, row) { | |
return $(row).text().split("•")[1].trim() == "Free to Ask"; | |
}).map(function (index, row) { | |
return $(row).closest('div.WantedAnswerSuggestionRow').find('a.ask_to_answer')[0]; | |
}).click(); |
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
nicks = %w{ | |
lm aji brodes cbgbt dru ek horm ianweller jruby khwain | |
montgc narada rd reed suroi suscd woodrufb | |
} | |
d = File.readlines('dictionary.txt').to_a | |
puts nicks.map {|nick| | |
o = nick.downcase!.dup | |
while (results = d.select{|line| line.chomp.end_with?(nick)}).length == 0 && nick.length > 0 | |
nick = nick[1, nick.length] | |
end |
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
expected = %w{1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz}; | |
seed = 0; | |
begin | |
puts "trying seed #{seed}" | |
r = Random.new(seed) | |
throw :nope unless (0..11).to_a.all? {|i| [i+1, "Fizz", "Buzz", "FizzBuzz"][r.rand(4)] == expected[i] } | |
puts "drusepth: Seed #{seed} will do the job just fine" | |
rescue | |
seed += 1 |
OlderNewer