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
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++) { |
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
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); | |
}, |
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
:: @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 |
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 Language | |
attr_accessor :name, :influence | |
def initialize(name,influence) | |
@name = name | |
@influence = influence | |
end | |
end | |
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
/* | |
* @author ananthakuaran | |
*/ | |
object BrainFuck { | |
val MAX_SIZE = 30000 | |
var pointer = 0 | |
val memory = new Array[Byte](MAX_SIZE) | |
def main(args:Array[String]) = { |
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
<distributionManagement> | |
<site> | |
<id>maven-demo</id> | |
<url>file:///${basedir}/../temp</url> | |
</site> | |
</distributionManagement> |
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
<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> |
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
(define lat? | |
(lambda (l) | |
(cond | |
((null? l) #t) | |
((atom? (car l)) (lat? (cdr l))) | |
(else #f)))) | |
(define atom? | |
(lambda (x) |
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.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'}; | |
/** |
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
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(); | |
} |
OlderNewer