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
/** | |
* Understanding Virtual Functions and Abstract Classes | |
* | |
* @author Amarnath R | |
*/ | |
/** | |
* Output: | |
* Time is 1300458436333 from SimpleDerivedClass | |
* DerivedConcreteClass is smelly |
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
(function($) { | |
function bindScroll() { | |
$(window).scroll(function(){ | |
var threshold = 0.8 * ($(document).height() - $(window).height()); | |
if ($(window).scrollTop() >= threshold){ | |
$(window).unbind('scroll'); | |
getNextPage(); | |
} | |
}); |
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 | |
ini_set('memory_limit', '256M'); | |
$maximum = 1000000; // a million if you were wondering.. | |
global $values; | |
function check_if_circular($prime) { | |
global $values; | |
$back2back = $prime . $prime; // 7373 | |
$count = strlen($prime); | |
for($i = 0; $i <= $count - 1; ++$i) { |
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 | |
// Source associative array 1 | |
$source1 = array( | |
2 => 'Hello', | |
3 => 'World' | |
); | |
// Source associative array 2 | |
$source2 = 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simple HTML</title> | |
<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.min.js"></script> | |
<style type="text/css"> | |
#navbar { | |
display: block; | |
} | |
#navbar ul { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My Bad</title> | |
<script type="text/javascript" src="/misc/jquery.js?v=1.4.2"></script> | |
<script type="text/javascript" src="/sites/all/modules/custom/t_samsungssa/js/teamie.js?v=1.0"></script> | |
<script type="text/javascript"> | |
// Initialize the client | |
var teamie = Teamie.getClient(); |
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 | |
// Fetch data from the database | |
function my_mod_fetch_from_db() { | |
// Remember the number of dimensions of the static cache depends | |
// on the number of parameters that this function can take. | |
$cache = &drupal_static(__FUNCTION__, array()); | |
// Static cache miss | |
if (empty($cache)) { | |
// Check persistent cache |
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 | |
define('BROWSER_LINE_SEPARATOR', '<br>'); | |
define('CLI_LINE_SEPARATOR', "\n"); | |
$separator = (php_sapi_name() == 'cli') ? CLI_LINE_SEPARATOR : BROWSER_LINE_SEPARATOR; | |
// A factory method that returns a object that can be mutated by the caller. | |
// The mutations are persisted across different calls to the function. | |
function factory1() { |
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 | |
$variable = 'Overriding value set by requiree.'; | |
global $variable2; | |
$variable2 = 'New global variable set by requiree.'; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Mojolicious::Lite; | |
my $app = app->start; | |
# When I go this page, I'd ideally want to see a HTTP 401 with an empty body. |
OlderNewer