Skip to content

Instantly share code, notes, and snippets.

View antsmartian's full-sized avatar
💭
Hacking...

antsmartian antsmartian

💭
Hacking...
  • India
View GitHub Profile
@antsmartian
antsmartian / occurrence.m
Last active August 29, 2015 14:00
Find the occurrence of a char in a string
#import <objc/objc.h>
#import <objc/Object.h>
#import <Foundation/Foundation.h>
@implementation TestObj
int main()
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// your code goes here
NSString *string1 = @"antoaravinth";
@antsmartian
antsmartian / DeletFile.vbs
Last active August 29, 2015 14:05
Script to delete the files for the given extensions
Function DeleteFilesWithGivenExtension()
'Change to False, if no need to delete read only file
Const deleteReadOnly = True
Dim directoryLocation
directoryLocation = InputBox("Give the directory location","DirectoryLocation")
Dim fileType
fileType = InputBox("File types to be deleted","File Type")
@antsmartian
antsmartian / moveFiles.vbs
Last active August 29, 2015 14:06
Move files from one directory to the given directory
Function MoveFiles()
Dim bob
Dim eob
'Change here if e(b)ob should be in caps
bob = "bob"
eob = "eob"
Dim directoryLocation
directoryLocation = InputBox("Give the directory location","DirectoryLocation")
@antsmartian
antsmartian / Monads
Created December 22, 2014 14:08
Monads in Groovy
def sin = { x ->
return [Math.sin(x),"Called"]
}
def cube = { x ->
return [x * x * x,"Hello "]
}
def compose = { f , g ->
@antsmartian
antsmartian / Parallel.groovy
Last active August 29, 2015 14:12
Parallel Computation in Groovy
import java.util.concurrent.*
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.function.Function;
ExecutorService executor = Executors.newFixedThreadPool(2);
def <A> Future<A> run(ExecutorService s, Closure<Future<A>> a) {
a(s)
}

Experimental Generation of Interpersonal Closeness

Instructions to Subjects Included With Task Slips Packet

This is a study of interpersonal closeness, and your task, which we think will be quite enjoyable, is simply to get close to your partner. We believe that the best way for you to get close to your partner is for you to share with them and for them to share with you. Of course, when we advise you about getting close to your partner, we are giving advice regarding your behavior in this demonstration only, we are not advising you about your behavior outside of this demonstration.

In order to help you get close we've arranged for the two of you to engage in a kind of sharing game. You're sharing time will be for about one hour, after which time we ask you to fill out a questionnaire concerning your experience of getting close to your partner.

You have been given three sets of slips. Each slip has a question or a task written on it. As soon as you both finish reading these instructions, you should

@antsmartian
antsmartian / FlipkartCodingSession1.java
Last active August 30, 2015 13:08
Flipkart selenium
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.FluentWait;
import com.google.common.base.Function;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.WebDriverWait;
@antsmartian
antsmartian / ProjectChangedSession.java
Last active September 12, 2015 10:29
Project Changed - Session
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.WebDriverWait;
@antsmartian
antsmartian / #King_Of_Kings.groovy
Created January 15, 2012 06:11
Problem solved on Top Coders.(14.2.500)
//map for managing the conversion from roman to no's
def map =[I:1,II:2,III:3,IV:4,V:5,VI:6,VII:7,VIII:8,IX:9,X:10,XI:11]
//map for managing the conversion from no to romans
def map1 = ['1':"I",'2':"II",'3':"III",'4':"IV",'5':"V",'6':"VI",'7':"VII",'8':"VIII",'9':"IX",'10':"X",'11':"XI"]
//temp variables
ans = []
res = []
//final result
res1 = []
//for managing the flow of algorithm