Skip to content

Instantly share code, notes, and snippets.

Peerapat A nuboat

Block or report user

Report or block nuboat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View LocalCache.java
package intercept;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LocalCache {
View Currency.java
/*
* (c) nuboat.net 2012
*/
package net.nuboat.currency;
/**
*
* @author nuboat
*/
import java.util.StringTokenizer;
View SlickSubscriberService.scala
// scalastyle:off
package services.slick
import javax.inject.Singleton
import define.JobLevel
import intercept.Logging
import models.{GroupJobLevel, Subscriber}
import org.postgresql.util.PSQLException
import play.api.Logger
@nuboat
nuboat / TwoSum.scala
Last active Aug 29, 2015
ปัญหา 2-SUM
View TwoSum.scala
object TwoSum {
def sum(n: Int, sorted: ArrayBuffer[Int]): Boolean = sorted.par.find(x => isMatch(x, n, sorted)).isDefined
def isMatch(x: Int, n: Int, sorted: ArrayBuffer[Int]): Boolean = sorted.find( y => (x + y) == n).isDefined
}
@nuboat
nuboat / HIndex.scala
Last active Aug 29, 2015
Thailandoi Programming Contest #2, March
View HIndex.scala
case class HIndex(publishs: List[Int]) {
val checklist = 0.to(publishs.max).sortWith(_ > _)
def calc(): Int = checklist.find(c => rule1(c) && rule2(c)).get
private def refer(c: Int): List[Int] = publishs.filter(_ >= c).toList
private def rule1(c: Int): Boolean = refer(c).size >= c
View InstallCert.java
package com.thjug.tools.sslcert;
import javax.net.ssl.*;
import java.io.*;
import java.security.KeyStore;
import java.security.MessageDigest;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
/**
View Expecte.rb
{1=>[1,1],
3=>[1,1,1,1],
5=>[1,1,1]
7=>[1,1],
2=>[1,1,1]}
You can’t perform that action at this time.