Basically, i tried to vary the speed of the dc motor, using a pnp transistor, connected the base of transistor to analog pin of arduino, which would be variable
I had used a 12v adapter to power the motor through the transistor, however the arduino was powered through the laptop's usb.
Hence for the transistor to work, i had to connect the adapter's ground to the arduino's ground
Now i think, that's what caused the problem, i think the "ground" of the adapter had voltage, which through the arduino connected to the laptop's ground and killed it.
Anyways, the instant i connected the adapter, a blue screen appeared on the laptop and it shut down, so i disconnected the adapter, and now the laptop doesn't turn on.
Note to self: Don't use external power supply and laptop connection at the same time
Edit:
Well folks I took John's advice and it worked! when i touched the laptop it was somewhat
hot, meaning it was running although the screen was off, i figured to take out the battery and when i put it back in, it started normally! also the port itself was not damaged as well, so that's great too. I thank you all for your help trying to figure out the problem
Here is some more info on what i did:
now I measured that usually the motor takes 100mA at 12V. and the Hfe of the transistor was 300, so current through base would be 100/300 = 0.34mA, and with 0.7v drop across base-collector, resistor at base would be (4.3*1000)/0.34 = 12,650 -120 = 12,530 ohm. (120 is resistance of the motor itself). i obviously did not have an exact resistor for this resistance, so i put 10k and 2.2k resistors in series to make 12.2k resistance. Then i connected the the base to the A1 pin of arduino(through the resistor ofcourse). Now my thinking was, that reducing the voltage at arduino's pin would therefore reduce base current, which would reduce collector current, and slow the motor down.
hopefully this is right, i'm new to this and have no prior experience in electronics so i'm not sure(as you probably would have guessed by now)
also this is the circuit(A1 is analog pin of arduino):



