Skip to content

Instantly share code, notes, and snippets.

View a1ip's full-sized avatar

Philippe Rigovanov a1ip

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- TUMBLR APPEARANCE OPTIONS -->
<meta name="if:Include Like Button" content="0">
<meta name="if:Include Tweet Button" content="0">
HANDY ONE-LINERS FOR RUBY November 16, 2005
compiled by David P Thomas <davidpthomas@gmail.com> version 1.0
Latest version of this file can be found at:
http://www.fepus.net/ruby1line.txt
Last Updated: Wed Nov 16 08:35:02 CST 2005
FILE SPACING:

Структура программы

  • require выражения

  • include выражения

  • определение классов и модулей

  • основная часть программы

  • код для тестирования

Исключения

Choices

  1. Install ghc 7.6.3 and Haskell Platform
  2. Install ghc 7.8.2 and Cabal

Option GHC 7.6.3 + Haskell Platform

GHC 7.6.3

Install Ubuntu 12.04 depencies:

@a1ip
a1ip / fizzbuzz.coffee
Created May 31, 2014 15:35
Elegant CoffeeScript FizzBuzz solution from http://rosettacode.org/
for i in [1..100]
console.log(['Fizz' if i % 3 is 0] + ['Buzz' if i % 5 is 0] or i)
@a1ip
a1ip / fizzbuzz.js
Created May 31, 2014 15:42
Elegant JavaScript FizzBuzz solution from http://en.wikipedia.org/wiki/Bizz_buzz
for (var i=1; i<=100; i++) {
var string = '';
if (i % 3 == 0) {
string += 'Fizz';
}
if (i % 5 == 0) {
string += 'Buzz';
}
@a1ip
a1ip / fizzbuzz.rb
Created May 31, 2014 15:45
Elegant Ruby FizzBuzz one-liner from http://rosettacode.org/
1.upto(100) { |i| puts "#{[:Fizz][i%3]}#{[:Buzz][i%5]}"[/.+/m] || i }
@a1ip
a1ip / fizzbuzz.js
Created May 31, 2014 15:49
Sortest JavaScript FizzBuzz one-liner from http://rosettacode.org/
for(i=0;i<100;console.log(++i%15?i%5?i%3?i:f='Fizz':b='Buzz':f+b));
@a1ip
a1ip / fizzbuzz.js
Created May 31, 2014 16:06
Elegant JavaScript bodyless for loop FizzBuzz one-liner from http://rosettacode.org/
for(var i=1; i<=100; console.log((i%3?'':'Fizz')+(i%5?'':'Buzz')||i), i++);
@a1ip
a1ip / fizzbuzz.js
Created May 31, 2014 16:08
Elegant JavaScript FizzBuzz one-liner from http://rosettacode.org/
for (var i=1; i<=100; i++) console.log( (i % 3 === 0 ? 'Fizz' : '') + (i % 5 === 0 ? 'Buzz' : '') || i );