This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| def reverseString(s:String) = (for(i<-s.length-1 to 0 by -1) yield s(i)).mkString | |
| //Java Version here: | |
| public class Test { | |
| public final String reverse(String s) { | |
| StringBuffer b = new StringBuffer(s.length()); | |
| for(int i = s.length()-1; i >=0; i--){ | |
| b.append(s.charAt(i)); |
This file contains hidden or 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 LinkedList<T> { | |
| private LinkedListNode<T> first = null; | |
| /** | |
| * Insert at the front of the list | |
| * @param node | |
| */ | |
| public void insert(LinkedListNode<T> node) { | |
| node.setNext(first); |
This file contains hidden or 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()); |
OlderNewer