Languages
389,506 gist results
389,506 gist results
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
{ | |
"selection1": [ | |
{ | |
"extract1": "Абиссинская" | |
}, | |
{ | |
"extract1": "Австралийский мист" | |
}, | |
{ | |
"extract1": "Азиатская (табби)" |
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
output = '' | |
animals = ['cat', 'dog', 'bird'] | |
animals.each do |animal| | |
output += output + animal + ' ' | |
end | |
puts output # cat cat dog cat cat dog bird |
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 Cat | |
attr_reader :color, :breed | |
attr_accessor :name | |
def initialize(color, breed) | |
@color = color | |
@breed = breed | |
@hungry = true | |
end | |
def feed(food) | |
puts "Mmmm, " + food + "!" |
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<stdio.h> | |
int main() | |
{ | |
int cat=0; | |
scanf("%d",&cat); | |
printf("%d",cat); | |
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
valueOpt.flatTraverse(compute) // also Future[Option[Int]]! |
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
package object_oriented_programming; | |
/** | |
* Базовый класс, который определяет базовое поведение всех котиков. | |
*/ | |
public class Cat { | |
boolean canPurr = true; | |
boolean canMeow = true; | |
int jumpIdentication = 0; | |
int JUMPS_HIGH = 0, JUMPS_LOW = 1, CANT_JUMP = 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
/*** | |
* ii. ;9ABH, | |
* SA391, .r9GG35&G | |
* &#ii13Gh; i3X31i;:,rB1 | |
* iMs,:,i5895, .5G91:,:;:s1:8A | |
* 33::::,,;5G5, ,58Si,,:::,sHX;iH1 | |
* Sr.,:;rs13BBX35hh11511h5Shhh5S3GAXS:.,,::,,1AG3i,GG | |
* .G51S511sr;;iiiishS8G89Shsrrsh59S;.,,,,,..5A85Si,h8 | |
* :SB9s:,............................,,,.,,,SASh53h,1G. | |
* .r18S;..,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....,,.1H315199,rX, |
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
def getItemById(itemId: Int): Future[Option[Item]] = /* ... */ | |
def ensureItemExists(itemId: Int): EitherT[Future, BaseException, Item] = { | |
OptionT(getItemById(itemId)) | |
.toRight(ItemNotFoundException(s"item not found, itemId = $itemId")) | |
} | |
def ensureItemStateIs(actual: String, expected: String): EitherT[Future, BaseException, Unit] = { | |
// Returns a Unit value wrapped into Right and then into Future if condition is true, |
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
valueOpt.traverse(compute).map(_.flatten) // has type Future[Option[Int]] |
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
/*** | |
* ii. ;9ABH, | |
* SA391, .r9GG35&G | |
* &#ii13Gh; i3X31i;:,rB1 | |
* iMs,:,i5895, .5G91:,:;:s1:8A | |
* 33::::,,;5G5, ,58Si,,:::,sHX;iH1 | |
* Sr.,:;rs13BBX35hh11511h5Shhh5S3GAXS:.,,::,,1AG3i,GG | |
* .G51S511sr;;iiiishS8G89Shsrrsh59S;.,,,,,..5A85Si,h8 | |
* :SB9s:,............................,,,.,,,SASh53h,1G. | |
* .r18S;..,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....,,.1H315199,rX, |