Troi's mom nails a cuddly science bear from the Kevorkian sector.
http://tng.trekcore.com/hd/albums/season-4/4x22/half-a-life-hd-239.jpg
| class NoiseCensor | |
| def initialize(chars = "&^%@*#") | |
| @noise = chars.split(//).shuffle.cycle | |
| end | |
| def censor(text) | |
| @noise.take(text.length).join | |
| end | |
| end |
| # https://en.wikipedia.org/wiki/Damm_algorithm | |
| module Damm | |
| extend self | |
| OP_TABLE = [ | |
| [0, 3, 1, 7, 5, 9, 8, 6, 4, 2], | |
| [7, 0, 9, 2, 1, 5, 4, 8, 6, 3], | |
| [4, 2, 0, 6, 8, 7, 1, 3, 5, 9], | |
| [1, 7, 5, 0, 9, 8, 3, 4, 2, 6], |
| use std::io; | |
| use std::io::BufRead; | |
| mod luhn { | |
| pub fn luhn(cardn: &str) -> bool { | |
| let chars : Vec<char> = cardn.chars().collect(); | |
| let mut sum = 0; | |
| let len = chars.len(); | |
| for ridx in 1..=len { |
| class Circuit | |
| class OKResult | |
| def initialize(value) | |
| @value = value | |
| end | |
| def if_break(&blk) | |
| self |
| require 'benchmark' | |
| require "benchmark/memory" | |
| N = 10_000_000 | |
| nonlazy = ->{ (1..N) .select(&:even?).map{|i| i*2 }.map{|i| i + 1 }.map(&:to_s).map(&:reverse).to_a.join(",").length } | |
| lazy = ->{ (1..N).lazy.select(&:even?).map{|i| i*2 }.map{|i| i + 1 }.map(&:to_s).map(&:reverse).to_a.join(",").length } | |
| one = ->{ | |
| (1..N).each_with_object([]) do |i,a| | |
| if i.even? |
Troi's mom nails a cuddly science bear from the Kevorkian sector.
http://tng.trekcore.com/hd/albums/season-4/4x22/half-a-life-hd-239.jpg
| puts "Ruby version: #{RUBY_VERSION}" | |
| def show_a_sym(sym) | |
| puts "sym #{sym} = #{sym.object_id}" | |
| end | |
| def pick_a_sym | |
| a = (1..100_000).map{|s| :"dummy-#{s}" } | |
| sym = a.sample | |
| show_a_sym sym |
| extern crate astar; // from https://github.com/mboeh/astar.git | |
| use std::vec::MoveItems; | |
| #[deriving(Eq)] | |
| #[deriving(Hash)] | |
| struct Room<'a> { | |
| id: int, | |
| difficulty: int, | |
| exits: Vec<&'a Room<'a>> |
| #include <stdio.h> | |
| #include <stdint.h> | |
| extern int32_t twice(int32_t, int32_t(*)(int32_t)); | |
| int32_t dbl(int32_t x) { | |
| /* x = arbitrary number here */ | |
| return x+x; | |
| } |
| FROM ubuntu:latest | |
| RUN apt-get update -y | |
| RUN apt-get install -y build-essential libgmp10-dev curl | |
| RUN curl -s -L http://downloads.sourceforge.net/project/mlton/mlton/20130715/mlton-20130715-1.amd64-linux.tgz | zcat - | tar x | |
| WORKDIR /home | |
| VOLUME /home |