Skip to content

Instantly share code, notes, and snippets.

View loliGothicK's full-sized avatar
:octocat:
may the --force be with you!

Mitama loliGothicK

:octocat:
may the --force be with you!
View GitHub Profile
@loliGothicK
loliGothicK / FizzBuzz.java
Last active March 1, 2017 19:25
一般的なセミコロンレスJavaのFizzBuzzです
public class FizzBuzz {
public static void main(String[] args){
for(int i : new int[] { 1 }) // define counter
for(int dummy : new int[100])
if( (
(i%15==0) ?
System.out.printf("FIZZBUZZ\n") == null
: (i%3==0) ?
System.out.printf("FIZZ\n") == null
: (i%5==0) ?
@loliGothicK
loliGothicK / EnumAnagramGen.java
Last active March 16, 2017 18:57
Java8 Stream API による、セミコロンレス「いなむのみたま」アナグラムジェネレーターです
public class EnumAnagramGen {
public static void main( String[] args ) {
for ( String str : new String[] { "いなむのみたま" }) {
try (java.util.stream.Stream<?> stream = java.util.stream.Stream.of().onClose(
() -> java.util.stream.Stream.<java.util.List<String>>of(
java.util.Arrays.<String>asList(str.split(""))
).peek(
e -> java.util.Collections.shuffle(e)
).forEach(
e -> e.stream().forEach(t -> java.lang.System.out.printf(t))
@loliGothicK
loliGothicK / file0.cpp
Last active May 15, 2021 04:21
C++のパラメータパック基礎&パック展開テクニック ref: https://qiita.com/_EnumHack/items/677363eec054d70b298d
template < typename ...Args >
void func( Args ...args );
@loliGothicK
loliGothicK / tie.hpp
Last active March 13, 2017 17:12
std::tieによる比較
#include <tuple>
#include <string>
struct Person {
std::string first_name;
std::string last_name;
int age;
};
bool operator<(const Person& x, const Person& y)
@loliGothicK
loliGothicK / strict_week_ordering.hpp
Last active March 13, 2017 16:57
tupleの比較の実装について
bool operator<(const Person& x, const Person& y)
{
return (x.last_name < y.last_name) || !(y.last_name < x.last_name)
&& ( (x.first_name < y.first_name) || !(y.first_name < x.first_name)
&& (x.age < y.age ));
}
#include <tuple>
#include <string>
class Person {
std::string first_name_;
std::string last_name_;
int age_;
public:
Person() = default;
Person(const Person&) = default;
#include <tuple>
#include <string>
#include <iostream>
#include <iomanip>
class Person {
std::string first_name_;
std::string last_name_;
int age_;
public:
#include <tuple>
#include <string>
#include <iostream>
#include <iomanip>
class Person {
std::string first_name_;
std::string last_name_;
int age_;
public:
@loliGothicK
loliGothicK / Generator.java
Created March 16, 2017 19:01
セミコロンあり
import java.lang.System;
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
public class Generator {
public static void main(String[] args){
String str = "いなむのみたま";
List<String> array = Arrays.<String>asList(str.split(""));
Collections.shuffle(array);
@loliGothicK
loliGothicK / Generator.java
Created March 16, 2017 19:05
import文削除
public class Generator {
public static void main(String[] args){
String str = "いなむのみたま";
java.util.List<String> array = java.util.Arrays.<String>asList(str.split(""));
java.util.Collections.shuffle(array);
array.stream().forEach(e->java.lang.System.out.printf(e));
}
}