Skip to content

Instantly share code, notes, and snippets.

View ananthakumaran's full-sized avatar

Anantha Kumaran ananthakumaran

View GitHub Profile
public class Prime {
public static boolean isPrime1(int n) {
if (n <= 1) {
return false;
}
if (n == 2) {
return true;
}
for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
MyApp.Ajax = {
// contains the list of handler to be invoked
// after ajax response
postAjaxHandlers : [],
// contains the ids of the changed elements
changedDomIds : [],
// registers the post ajax handles
registerPostAjax : function(fn) {
this.postAjaxHandlers.push(fn);
},
:: @author ananth
:: Blogging
@echo off
:: start the Git Bash
start "Git Bash" /DD:\Git_Repo\ananthakumaran.github.com "cmd" /c ""e:\Program Files\Git\bin\sh.exe" --login -i "
:: start the server
start D:\Git_Repo\ananthakumaran.github.com
:: go to the project directory
cd /d D:\Git_Repo\ananthakumaran.github.com
:: start the server
class Language
attr_accessor :name, :influence
def initialize(name,influence)
@name = name
@influence = influence
end
end
/*
* @author ananthakuaran
*/
object BrainFuck {
val MAX_SIZE = 30000
var pointer = 0
val memory = new Array[Byte](MAX_SIZE)
def main(args:Array[String]) = {
<distributionManagement>
<site>
<id>maven-demo</id>
<url>file:///${basedir}/../temp</url>
</site>
</distributionManagement>
<distributionManagement>
<site>
<id>maven-demo</id>
<url>file:///${basedir}/../../../temp</url>
</site>
<repository>
<id>maven-demo</id>
<url>file:///${basedir}/../../../temp/maven2</url>
</repository>
</distributionManagement>
(define lat?
(lambda (l)
(cond
((null? l) #t)
((atom? (car l)) (lat? (cdr l)))
(else #f))))
(define atom?
(lambda (x)
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class HashService {
public static char[] HEX_CHARS = new char[] {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
'E', 'F'};
/**
public static byte[] readFully(InputStream input) throws IOException {
byte[] buffer = new byte[8192];
int bytesRead;
ByteArrayOutputStream output = new ByteArrayOutputStream();
while ((bytesRead = input.read(buffer)) != -1) {
output.write(buffer, 0, bytesRead);
}
return output.toByteArray();
}