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 com.nealford.ft.patterns | |
import org.junit.Test | |
import static groovy.util.GroovyTestCase.assertEquals | |
// BEGIN groovy_calc | |
interface Calc { | |
def product(n, m) | |
} |
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 templates; | |
abstract class Customer { | |
def plan | |
def Customer() { | |
plan = [] | |
} | |
def abstract checkCredit() |
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
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
import java.util.stream.Stream; | |
import static java.lang.Math.sqrt; | |
import static java.util.stream.Collectors.toList; | |
import static java.util.stream.IntStream.range; | |
public class NumberClassifier { |
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
object 부분적용 { | |
def price(product: String): Double = | |
product match { | |
case "apples" => 140 | |
case "oranges" => 223 | |
} | |
def withTax(cost: Double, state: String): Double = | |
state match { |
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
object curringTest extends App { | |
def filter(xs: List[Int], p: Int => Boolean): List[Int] = | |
if (xs.isEmpty) xs | |
else if (p(xs.head)) xs.head :: filter(xs.tail, p) | |
else filter(xs.tail, p) | |
def modN(n: Int)(x: Int) = (x % n) == 0 | |
val nums = List(1,2,3,4,5,6,7,8) | |
println(filter(nums, modN(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
// BEGIN imp_classifier | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Map; | |
import java.util.Set; | |
public class ImpNumberClassifierSimple { | |
private int _number; //<1> | |
private Map<Integer, Integer> _cache; //<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
# -*- coding: utf-8 -*- | |
# !/usr/bin/env python3 | |
import re | |
from random import choice | |
import os.path | |
import requests | |
from lxml import etree | |
from bs4 import BeautifulSoup |
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 Geek: | |
def __init__(self, bb, cc, dd) -> None: | |
super().__init__() | |
self.bb = bb | |
self.cc = cc | |
self.dd = dd | |
self.input = "" | |
self.print_go(bb, cc, dd) |
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
import com.google.gson.JsonArray; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonParser; | |
import com.sun.media.jfxmediaimpl.MediaDisposer; | |
import io.reactivex.Observable; | |
import io.reactivex.disposables.Disposable; | |
import io.reactivex.functions.Function; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; |
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
#!/usr/bin/python3 | |
# Normal | |
def test_custom_parser(self): | |
file_paths = glob.glob("/Users/len/log-analyer-assignment/logdata/20180824/*.txt", recursive=False) | |
start_time = time.time() | |
for file_path in file_paths: | |
with open(str(file_path), 'r', encoding='utf8') as infile: | |
lines = infile.readlines() | |
for row_list in tqdm(lines): |
NewerOlder