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
| #include <stdio.h> | |
| #include <math.h> | |
| int main() { | |
| int t, a, b, b2, b4, s, p; | |
| scanf("%d", &t); | |
| typedef double d; | |
| while(t--) { | |
| scanf("%d %d", &a, &b); | |
| a %= 10; | |
| b2 = (b>2)?b%2:b; |
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
| --->->>->++++++++++++++++++++++++++++>++>-->+>++ | |
| +++++>++>-->++++++++++++++++++>+++++++>+++++++++ | |
| ++++++++++++>-->++++++++>+++++++++>++++++++++>++++++++>+++++ | |
| +>++++++++++++>++++++>+>+++++++>++++++++++>+++++>-->++++++++ | |
| +>++++++>++>->++++++++++++>++>+++++++++++++>-->++++++++>>+++ | |
| ++++++++++>-->++++++++++++++>>+++++++++++>+>+++++++++ |
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
| require 'rubygems' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'net/http' | |
| class NokoLinkSet < Nokogiri::XML::NodeSet | |
| # Create new LinkSet object from the url and the selector | |
| def initialize(url, selector) | |
| if not ( url.nil? and selector.nil? ) | |
| @raw_html = open(url) |
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
| README.ext | |
| http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_8_6/README.EXT?revision=12055 | |
| Extending Ruby - Pickaxe | |
| http://ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html | |
| Extending Ruby on O'Reilly | |
| http://onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html | |
| Ruby C Extensions - Mark Volkman |
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
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
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
| // | |
| // breakout.c | |
| // | |
| // Computer Science 50 | |
| // Problem Set 3 | |
| // | |
| // standard libraries | |
| #define _XOPEN_SOURCE | |
| #include <stdio.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
| require 'matrix' | |
| module NumericUnicodeSubscripts | |
| UNICODE_SUBSCRIPTS_0_TO_9 = [ | |
| "\u2080", | |
| "\u2081", | |
| "\u2082", | |
| "\u2083", | |
| "\u2084", | |
| "\u2085", |
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
| Pending: (Failures listed here are expected and do not affect your suite's status) | |
| 1) Distribution::Uniform singleton it should behave like uniform engine .rng should generate sequences with the right mean & variance | |
| # This method is very innacurrate due to the low convergence rate | |
| # ./spec/uniform_spec.rb:8 | |
| 2) Distribution::Uniform Distribution::Uniform::Ruby_ it should behave like uniform engine .rng should generate sequences with the right mean & variance | |
| # This method is very innacurrate due to the low convergence rate | |
| # ./spec/uniform_spec.rb:8 |
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 GoodnessOfFit | |
| # All goodness of fit helpers go here | |
| ## Pearson's chi squared test for goodness of fit | |
| # == References | |
| # * http://stattrek.com/chi-square-test/goodness-of-fit.aspx?Tutorial=AP | |
| # * https://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)#Residuals | |
| # | |
| # The null hypothesis is always that the +candidate+ does belong to | |
| # the +target+ distribution. |
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 rb_rand_entropy(num_trials) | |
| a = Array.new(num_trials) {rand(100)} | |
| p = [] | |
| 0.upto(99) do |i| | |
| p[i] = a.count(i) / num_trials.to_f | |
| end | |
| return p.map {|c| -c * Math.log(c)}.reduce(:+) | |
| end |
OlderNewer