This file contains 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
# Collatz Conjecture | |
n = gets.chomp.to_i | |
loop do | |
break if n == 1 | |
n = n%2 == 0 ? n/2 : 3*n+1 | |
p n | |
end |
This file contains 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 add(a,b) | |
a-b | |
end | |
def multiply(a,b) | |
result = 0 | |
a.times do | |
result = add(result, b) | |
end | |
b |
This file contains 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 add(a,b) | |
a+b | |
end | |
def multiply(a,b) | |
result = 0 | |
a.times do | |
result = add(result, b) | |
end | |
b |
This file contains 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 add(a,b) | |
a+b | |
end |
This file contains 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
<?php | |
require_once "listwiki.php"; | |
$test=new ListWiki("http://en.wikipedia.org/wiki/PHP"); | |
echo $test->getJSON(); //Returns the wiki's textual content as JSON | |
print_r($test->getArray()); //Returns the wiki's textual content as PHP Array |
This file contains 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
<?php | |
$gcm= new GCMUtility('<your api key>'); | |
$gcm->set_time_to_live(<seconds>); //*** optional parameter : int | |
$gcm->set_restricted_package_name(<restricted package name>); //*** optional parameter: string | |
$gcm->set_device_ids(<device IDs given by GCM>); // mandatory parameter: either array of strings or a string | |
$gcm->set_message(<message to be sent>); // mandatory parameter: either a string or array of string with string keys ;example: array("number":"345"); | |
if($gcm->send())echo "Message Sent"; | |
else echo "Message Sending not Successful"; |
This file contains 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
<?php | |
$start=115014000; // Starting Registration Number | |
$dbh=mysqli_connect("localhost","root","","sastra"); | |
for($i=0;$i<119;$i++){ //119 people at ICT | |
$start=$start+1; | |
$ch=curl_init(); | |
set_time_limit(0); | |
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($ch,CURLOPT_USERAGENT," Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 "); | |
curl_setopt($ch,CURLOPT_URL,"http://www.sastra.edu/result13/"); |
This file contains 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
window.onload = function(){ | |
new JsDatePick({ | |
useMode:2, //These are options available for the Date Picker! know more about them on link below! | |
target:"date", //ID of the textbox to which you want to apply the Date Picker | |
dateFormat:"%Y-%m-%d", //Date format: here I gave as YYYY-MM-DD. to change this to DD-MM-YYYY use %d-%m-%Y | |
limitToToday:true //Limit date to the current system date so that user cannot select the future dates | |
}); | |
} |
This file contains 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
<script type="text/javascript" src="js/jquery.1.4.2.js"></script> | |
<script type="text/javascript" src="js/jsDatePick.jquery.min.1.3.js"></script> | |
<link rel="stylesheet" type="text/css" media="all" href="css/jsDatePick_ltr.min.css" /> |
This file contains 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
$("a[href='#top']").click(function() { | |
$("html, body").animate({ scrollTop: 0 }, "slow"); | |
return false; | |
}); //jquery |
NewerOlder