Skip to content

Instantly share code, notes, and snippets.

<?php
ini_set('display_errors', 0);
$config_file = 'config.json';
$log_file = 'webhook.log';
/** * Minimal Logging Class */
class Logger
{
private $logfile;
<?php
function paragraph($s) {
$arr = explode(PHP_EOL, $s);
for ($i = 0; $i < count($arr); $i++) {
if (($i == 0 || strlen($arr[$i-1]) == 0) &&
($i == count($arr)-1 || strlen($arr[$i+1]) == 0) &&
(preg_match('/^\\s*<.+>/', $arr[$i]) == 0)) {
$arr[$i] = '<p>' . $arr[$i] . '</p>';
}
__halt_compiler
array
die
echo
empty
eval
exit
include
include_once
isset
def fib_generator(n):
xs = [1, 1]
yield xs[0]
yield xs[1]
for i in range(2, n):
xs.append(xs[i - 1] + xs[i - 2])
yield xs[-1]
def FizzBuzz(n):
if n == 0:
return str(0)
elif n % 15 == 0:
return "FizzBuzz"
elif n % 3 == 0:
return "Fizz"
elif n % 5 == 0:
return "Buzz"
return str(n)
#include <vector>
#include <numeric>
#include <iostream>
class Piece
{
private:
std::vector<double> edges;
std::vector<double> degrees;
std::size_t used;
#include <iostream>
#include <string>
#include <cstdint>
/**
* Fizz Buzz
* @param std::uint32_t n number to judge fizz or buzz or fizzbuzz or else
* @return std::string "Fizz" or "Buzz" or "FizzBuzz" or "n"
*/
std::string fizz_buzz(std::uint32_t n)
@theoremoon
theoremoon / main.cpp
Created April 8, 2016 13:39
hello_world_cpp
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
@theoremoon
theoremoon / por.py
Created November 8, 2015 08:35
SECCON福島大会 サイバー甲子園 Programming 200pt
import re
S = """1lp(34) 6eqq0(28) 1e1c(15) / 9i7(28) * + 12db(31) * -12221111(3) 1211201(4) 13ldi(29) 14610(7) / * + - 1733k(21) 613401(8) * 2r5a(31) - * 1amp5(27) 403603(7) * aq53(32) + + 71148(11) 1g890(19) h5ha(19) * + ao13(31) 9501(15) * 6h8k(36) - 29dc2(15) 323030330(4) 8581b(12) * + * + * -51e(21) 5346(9) 99b(16) * + 680k(25) * 211222240(5) b68(23) / 682(13) 908(21) * + - dh01(25) 169b(15) 111011000000110011(2) * + * egl(24) 1884342(9) 37g(21) / * 1020020(4) + 9fe1(17) * zy(36) 121jg9(23) 5t0(35) / a93(22) * + - - + 61179(20) 450363(8) -e8g(22) 1232201(4) 7c0b6(21) hag(22) / * + * + e9a5(17) 13191 onqd(27) * + -1045 5c4(24) 1486(11) * + 5eig(19) * -100101010110(2) 2ka(31) 14123(5) * + + * + 1012211102010(3) nrk(32) * 341365(9) + 168193(14) 63a(20) * 868044(9) - 63505(11) 1d555(15) 313432(9) * + * + -bb1(18) 7rl(33) 2e2ug(32) 17b2(14) / * + nd0(35) * 1i43e(24) + e8wb(35) 1b25(34) 134442303(5) * + * 2601(8) 1200002(3) 2el(29) * + 23103133(4) * afg5(23) - - * + * 1538h(27) 2d55c(14) * 6b3p(35) - 15qm7(28
@theoremoon
theoremoon / base.py
Created November 8, 2015 08:34
SECCON福島大会 サイバー甲子園の Programming 300pt問題
scount = 0
bcount = 0
fcount = 0
ocount = 0
runners = [0, 0, 0, 0]
pts = [0, 0]
turn = 0
def out():
global scount