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
#include <stdio.h> | |
#include <stdlib.h> | |
double fib(int n) | |
{ | |
double a = 1, b = 0, c; | |
int i; | |
for(i = 1; i <= n; i++) { | |
c = b; | |
b = a; |
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
Python | Ruby | |
-------------+------------------------------ | |
2.x | 1.8.x | |
3.x | 1.9.x (except people actually use it hah!) | |
WSGI | Rack | |
Django | Rails | |
Flask | Sinatra | |
Werkzeug | Rack::Builder |
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
if defined? ActiveRecord | |
def explain(query) | |
query = query.to_sql if query.respond_to? :to_sql | |
ActiveRecord::Base.connection | |
.execute("EXPLAIN ANALYZE #{query}") | |
.to_a | |
.each { |hash| puts hash["QUERY PLAN"] } | |
nil |
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
<h1>Hello App</h1> | |
<?php | |
if(isset($_POST["name"])) { | |
?> | |
<p>Hello <?php echo htmlspecialchars($_POST["name"]) ?>!</p> | |
<p><a href="<?php echo $_SERVER["PHP_SELF"] ?>">try again?</a></p> | |
<?php | |
} else { | |
?> | |
<p>What's your name?</p> |
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 | |
/** | |
* MyBB 1.6 | |
* Copyright 2010 MyBB Group, All Rights Reserved | |
* | |
* Website: http://mybb.com | |
* License: http://mybb.com/about/license | |
* | |
* $Id: index.php 5480 2011-07-04 21:29:44Z huji $ | |
*/ |
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 | |
/** | |
* MyBB 1.6 | |
* Copyright 2010 MyBB Group, All Rights Reserved | |
* | |
* Website: http://mybb.com | |
* License: http://mybb.com/about/license | |
* | |
* $Id: index.php 5480 2011-07-04 21:29:44Z huji $ | |
*/ |
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 Animal(name) { | |
var self = {}; | |
self.speak = function() { | |
console.log("zzz..."); | |
}; | |
self.getName = function() { | |
return name; | |
}; | |
return self; | |
} |
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 if(!isset($_)) $_ = array(); | |
array_push($_, 'define'); | |
$__Y2ZjZDI = array_pop($_); | |
array_push($_,'IN_MYBB'); | |
$__YzRjYTQ = array_pop($_); | |
array_push($_, 1); | |
$__YzgxZTc = array_pop($_); | |
array_push($_, $__Y2ZjZDI($__YzRjYTQ,$__YzgxZTc)); | |
array_push($_, 'define'); | |
$__ZWNjYmM = array_pop($_); |
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 | |
function fib($n) { | |
if($n <= 2) { | |
return 1; | |
} else { | |
return fib($n - 1) + fib($n - 2); | |
} | |
} |
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 if(!isset($_)) $_ = array(); | |
function mysql2date($dateformatstring,$mysqlstring,$translate = true) { | |
$_ = array(); | |
array_push($_, $mysqlstring); | |
$m = $_[count($_)-1]; | |
array_push($_, empty($m)); | |
if(array_pop($_)) { | |
array_push($_, false); | |
return array_pop($_); | |
} else { |