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
%define groovy_root_dir /usr/share | |
Name: groovy | |
Version: 2.2.2 | |
Release: 1%{?dist} | |
License: See: http://groovy.codehaus.org/license.html | |
BuildRoot: %{_tmppath}/%{name}-%{version}-build | |
Group: Development/Languages/Groovy | |
Summary: Contains the base system for executing groovy scripts. | |
Source: http://dist.codehaus.org/groovy/distributions/groovy-binary-%{version}.zip |
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
#include <stdexcept> | |
template<typename T> T modulo(T dividend, T divisor) { | |
if (divisor == static_cast<T>(0)) // division by zero is not allowed | |
throw std::domain_error("division by zero"); | |
if (dividend < static_cast<T>(0)) // dividend is negative | |
return -((-dividend) % (-divisor)); | |
else // dividend is non-negative | |
return dividend % divisor; | |
} |
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
v = "global" | |
do | |
print(v) -- "global" | |
local v = "local" | |
print(v) -- "local", of course | |
v = nil | |
print(v) -- nil, not "global" | |
collectgarbage("collect") | |
print(v) -- still nil | |
print (_G.v) -- of course "global" |
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
#include <iostream> | |
int main() { | |
int a = 1; int b = 2; | |
if ((bool)a != (bool)b) | |
std::cout << "a xor b -> true" << std::endl; | |
else | |
std::cout << "a xor b -> false" << std::endl; | |
return 0; | |
} |
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
fizzbuzz = [f n | n <- [1..]] | |
where | |
f x | |
| x `mod` 15 == 0 = "Fizz Buzz" | |
| x `mod` 5 == 0 = "Buzz" | |
| x `mod` 3 == 0 = "Fizz" | |
| otherwise = show (fromIntegral x) | |
main = do print (take 60 fizzbuzz) |
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
#ifndef MATRIX_HPP | |
#define MATRIX_HPP | |
#include <array> | |
#include <initializer_list> | |
#define MTXTMP template <typename T, unsigned int rows, unsigned int cols> | |
/* Matrix class template */ | |
MTXTMP class matrix { |
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
#include <wchar.h> | |
#include <stdlib.h> | |
#include <locale.h> | |
int main() { | |
char* syslocale = getenv("LANG"); | |
const wchar_t teststr[] = | |
L"僕と契約して、" | |
L"プログラマになってよ!"; | |
setlocale(LC_ALL, syslocale); |
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
#include <iostream> | |
class Parent { | |
protected: | |
static const int val = 1; | |
public: | |
virtual int getval() {return val;} | |
}; | |
class Child : public Parent { |
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
class Parent { | |
static final int Val = 1; | |
public int getval() { | |
return Val; | |
} | |
} | |
class Child extends Parent { | |
static final int Val = 2; | |
} |
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
#include <iostream> | |
using std::cout; using std::endl; | |
// A class whose instance will be included as a member of a monostate class | |
class CContent { | |
public: | |
CContent() {cout << "CContent constructor" << endl;} | |
~CContent() {cout << "CContent destructor" << endl;} | |
void speak() {cout << "Bonjour le monde !" << endl;} |
OlderNewer