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
факториал Ruby | |
2.3.1 :001 > def factorial n | |
2.3.1 :002?> n > 1 ? n * factorial(n - 1) : 1 | |
2.3.1 :003?> end | |
2.3.1 :004 > factorial(3) | |
=> 6 | |
Фибоначчи Ruby one line | |
2.5.1 :025 > print (1...10).inject( [0, 1] ) { | fib | fib << fib.last(2).inject(:+) } |
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 <stdlib.h> | |
#include <math.h> | |
#include <curses.h> | |
#include <cmath> | |
int main(int argc, const char * argv[]) | |
{ | |
// заполняем двумерный массив рандомными значениями | |
const int R = 15; | |
const int C = 12; |
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 <stdlib.h> | |
#include <math.h> | |
#include <curses.h> | |
#include <cmath> | |
#include <algorithm> | |
#include <iostream> | |
#include <time.h> | |
int main(int argc, const char * argv[]) | |
{ |
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 <string> | |
#include <stdio.h> | |
#include <iostream> | |
#include <fstream> | |
#include <sstream> | |
using namespace std; | |
int main() | |
{ |
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
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
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
pry(3)> {status, _body} = | |
...(3)> NDCEx.request(:SeatAvailability, test_data[:SeatAvailability], provider_config, consumer_config) | |
20:00:01.868 [debug] <?xml version="1.0" encoding="UTF-8" ?> | |
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> | |
<s:Body xmlns="http://www.iata.org/IATA/EDIST"> | |
<SeatAvailabilityRQ> | |
<Document> | |
<MessageVersion>1.3</MessageVersion> | |
</Document> |
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 <stdlib.h> | |
#include <math.h> | |
#include <curses.h> | |
#include <cmath> | |
#include <algorithm> | |
#include <iostream> | |
#include <time.h> | |
// Задача 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
// | |
int x; | |
int d[] = {3, 4, 5, 6}; | |
x = d[2] + 3*d[3]; | |
const int N = 10; | |
int i, a[N]; | |
for(i=0; i<N; i++) { | |
printf("Введите a[%d]: ", i) | |
scanf("%d\n", &a[i]); |
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
int main(int argc, const char * argv[]) { | |
int num, new_num(0), i(0), new_i(0), temp_i; | |
printf("введите x\n"); | |
scanf("%i", &num); | |
temp_i = i; | |
while (i <= num) { | |
while (i) { | |
new_i = i*10 + (i % 10); | |
i = i/10; |
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 ConfigsController < ApplicationController | |
skip_before_filter :verify_authenticity_token, only: [:create, :new] | |
... | |
end |