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
String string = "-12.49"; | |
boolean isNumeric = string!=null && string.length() > 0 && string.toUpperCase().equals(string.toLowerCase()); |
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 oauth2 as oauth | |
import urllib | |
def yam(): | |
consumer_key = YOUR_CONSUMER_KEY | |
consumer_secret= YOUR_CONSUMER_SECRET | |
access_token = YOUR_ACCESS_TOKEN | |
access_token_secret = YOUR_ACCESS_TOKEN_SECRET | |
consumer = oauth.Consumer(consumer_key, consumer_secret) | |
token = oauth.Token(access_token,access_token_secret) | |
client = oauth.Client(consumer,token) |
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
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",your_cluster_name).build(); | |
TransportClient client = new TransportClient(settings); |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>net.manish</groupId> | |
<artifactId>scala-simple</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<name>${project.artifactId}</name> | |
<description>My wonderfull scala app</description> | |
<inceptionYear>2010</inceptionYear> | |
<licenses> | |
<license> |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
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.ign.traffic; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.entity.StringEntity; | |
import org.apache.http.impl.client.DefaultHttpClient; |
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 PalindromeCheck { | |
public final boolean isPalindrome(String s) { | |
boolean isPalindrome = true; | |
for (int i = 0; i < s.length(); i++) { | |
if (!(s.charAt(i) == s.charAt(s.length() - i - 1))) { | |
isPalindrome = false; | |
break; | |
} | |
} |
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 Map { | |
public static void main(String[] args) { | |
HashMap<Integer,Long> map = new HashMap<Integer,Long>(); | |
for(int i = 0;i<100;i++){ | |
map.put(i,System.nanoTime()); | |
} | |
Iterator<Integer> it = map.keySet().iterator(); | |
while(it.hasNext()){ | |
map.remove(it.next()); |
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.Stack; | |
public class Bucket { | |
private Stack<Long> stack = new Stack<Long>(); | |
private int MAX_SIZE = 20; | |
public Long consume(){ |
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 ArraySum { | |
private int[] array = new int[]{1,2,3,4,5,6,7,8,9}; | |
/** | |
* Do any 2 add up to this number | |
* @param number | |
* @return | |
*/ | |
public boolean canAdd(int number){ |
OlderNewer