Jquery img src change on screen width/resize

Here is a quick example. http://jsfiddle.net/9v7ad/1/ <html> <img id=”my-img” src=””> </html> <script> $(document).ready(function(){ if($(window).width() < 640 ) { $(‘#my-img’).attr(‘src’,’http://www.24k.com.sg/images/uploads/hosting.jpg’); } if($(window).width() > 640 ) { $(‘#my-img’).attr(‘src’,’http://www.cadac.com/organice/Style%20Library/Images/organice/mainimg/mi-sol-hosted.jpg’); } }); $(window).resize(function() { if($(window).width() < 640 ) { $(‘#my-img’).attr(‘src’,’http://www.24k.com.sg/images/uploads/hosting.jpg’); } if($(window).width() > 640 ) { $(‘#my-img’).attr(‘src’,’http://www.cadac.com/organice/Style%20Library/Images/organice/mainimg/mi-sol-hosted.jpg’); } }); </script>

Most useful Fortigate commands for troubleshooting connections

I use this commands a lot when testing VPNs, ACL Policies, and basic communication problems. To see all configurations in your unit show full To see a brief configuration list show To restart a VPN tunnel (Change “Tennessee ” to phase1 name) diag vpn tunnel flush Tennessee diag vpn tunnel reset Tennessee To…

JavaScript img src changer based on hover and unhover

Sorry the demo doesn’t work, if the images existed it would. Use two files ../icondatalink.png and ../iconhoverdatalink.png This is a dynamic image src changer based on hover and unhover. Here is a quick example. http://jsfiddle.net/3tn2w/ <html> <img id=”my-img” src=”../icondatalink.png” onmouseover=”hover(this);” onmouseout=”unhover(this);” /> </html> <script> function hover(element) { var path = element.getAttribute(“src”);…

JavaScript that changes Text box to blank when clicked

Here is a quick example. http://jsfiddle.net/9NTbX/ <html> <input type=”text” id=”UserName” name=”UserName” value=”UserName” onclick=”usernametoblank_clickHandler();”> </html> <script> function usernametoblank_clickHandler() { var val = document.getElementById(“UserName”).value; if (val ==  “UserName”) { document.getElementById(“UserName”).value = “”; } } </script>

JavaScript comma delimited input check boxes

Here is a quick example. http://jsfiddle.net/DXSDK/ <html> <input type=”checkbox” onclick=”checkbox_clickHandler(1);”> <input type=”checkbox” onclick=”checkbox_clickHandler(2);”> <input type=”checkbox” onclick=”checkbox_clickHandler(3);”> <input type=”checkbox” onclick=”checkbox_clickHandler(4);”> <input type=”checkbox” onclick=”checkbox_clickHandler(5);”> <input type=”checkbox” onclick=”checkbox_clickHandler(6);”> <input type=”checkbox” onclick=”checkbox_clickHandler(7);”> <input type=”checkbox” onclick=”checkbox_clickHandler(8);”> <input type=”checkbox” onclick=”checkbox_clickHandler(9);”><br> <input type=”text” id=”AccessList”> </html> <script> function checkbox_clickHandler(SiteID) { var str = document.getElementById(“AccessList”).value; var res = str.split(“,”);…

Python Count every char in a text file

letters = [‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’,’j’,’k’,’l’,’m’,’n’,’o’,’p’,’q’,’r’,’s’,’t’,’u’,’v’,’w’,’x’,’y’,’z’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’U’,’V’,’W’,’X’,’Y’,’Z’] counter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] i = 0 print “Started” with open(‘alice.txt’) as f: while True: c = f.read(1) if not c: print “Done” break for letter in letters: if c == letter: counter[i] = counter[i] + 1 i = 0 break i = i + 1 if i…

IR PC Remote & Youtube Playlist Controller

Here is the how to, for the program HOTKEYS and how to setup the VOL UP DOWN hotkeys. You will also need the IRremote library from PJRC. Use the IRDemo sketch that comes with the library to find the codes from your remote some might be different than what I have….

Xbox 360 Rapid Fire Mod V2

The code: https://github.com/smccombs/XboxRapidFireModV2/blob/master/main.ino Ref. Please check out version one of the mod on this website for more information. http://hlt.media.mit.edu/?p=1695  

Xbox 360 Rapid Fire Mod V1

Adjustable Xbox 360 Rapid Fire Mod Using Arduino Attiny85 The switch on the left controls rapid fire on/off. The knob changes the speed of fire, while switch is on. I also added a led to tell me if the attiny was getting power. Needed: Arduino FTDI cable Attiny85 10uf capacitor 14.8k resistor DPDT switch…