Code Is Poetry

Life is Binary

Posts

Python 1: decalring variables

# Declare a variable and initialize itf = 0;print f# re-declaring the variable worksf = "abc"print f# ERROR: variables of different types cannot be combined#print "string type " + 123print "string type " + str(123)# Global vs. local variables in functionsdef someFunction():  #global f  f = "def"  print fsomeFunction()print f del fprint f

Read more

Javascript: url extraction from string

                    var string = "http://blog.tushersuvro.com - the site of a full stack web developer";                     if(new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?").test(string))...

Read more

Javascript: textarea autogrow globally

The following code can be used globally for any textarea where while user typing on it, it will grow automatically with typing.        $(document).on('keyup', 'textarea', function (e) {            while($(this).outerHeight() < this.scrollHeight + parseFloat($(this).css("borderTopWidth")) + parseFloat($(this).css("borderBottomWidth")))...

Read more

Bootstrap3 offcanvas html with jQuery

html:        <nav class="navbar navbar-inverse navbar-fixed-top hidden-md hidden-sm hidden-lg">          <div class="container-fluid">            <div class="navbar-header">              <button type="button" class="navbar-toggle...

Read more

Virtual Host setup on WAMP

Include You Virtual Host Configuration File in Apache Open your Apache configuration file located in C:\wamp\bin\Apache#.#.#\conf\httpd.conf, where #.#.# corresponds to the version of Apache that you are running in WAMP.   Apache Configuration File Search for “LoadModule vhost_alias_module” (without the quotes) and uncomment the LoadModule vhost_alias_module modules/mod_vhost_alias.so directive below.   Include Virtual Host Module Search for...

Read more

Binary Tree in PHP

<?php class BinaryNode { public $value; // contains the node item public $left; // the left child BinaryNode public $right; // the right child BinaryNode public function __construct($item) { $this->value = $item; // new nodes are leaf nodes $this->left = null; $this->right = null; } }   // inserting into Binary Tree class BinaryTree { ... public function insert($item) { $node =...

Read more

internet download manager crack in a new way

The new way is the easiest way. After cracking and patching IDM, just go to the installation folder of IDM “C:\Program Files (x86)\Internet Download Manager” and rename the “IDMGrHlp.exe” to anything.But wait! Every time you run IDM, there would be a new popup box saying “IDM cannot find 1 files that are necessary for browser and system integration. Please reinstall IDM“. To get rid of it, place anything in “C:\Program Files (x86)\Internet Download...

Read more

Php - getting different time of a single day

<?php /* This sets the $time variable to the current hour in the 24 hour clock format */ $time = date("H"); /* Set the $timezone variable to become the current timezone */ $timezone = date("e"); /* If the time is less than 1200 hours, show good morning */ if($time <"12"){ echo "Good morning";} else/* If the time is grater than or equal to 1200 hours, but less than 1700 hours, so good afternoon */ if($time >="12"&& $time...

Read more

javascript Multiple defer elemetns example

javascript Multiple defer elemetns example (function(){function getScript(url,success){var script=document.createElement('script'); script.src=url;var head=document.getElementsByTagName('head')[0],done=false; script.onload=script.onreadystatechange =function(){if(!done&&(!this.readyState ||this.readyState =='loaded'||this.readyState =='complete')){done=true; success(); script.onload = script.onreadystatechange =null; ...

Read more