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 fibonacci( n ) | |
{ | |
prev_1 = total = 0; | |
prev_2 = 1; | |
if ( n == 0 ) | |
return 0; | |
if ( n < 3 ) | |
return 1; | |
for ( var i = 0; i < n - 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
function fibonacci(n, recursive) | |
{ | |
if ( n == 0 ) | |
return 0; | |
if ( n < 3 ) | |
return 1; | |
if ( recursive !== true ) | |
n--; | |
return fibonacci( n-1, true) + fibonacci( n-2, true); | |
} |
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
<div id="slider"> | |
<img> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide1.png"> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide2.png"> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide3.png"> | |
<input type="hidden" value="/wp-content/themes/geek/images/slide4.png"> | |
</div> |
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 <iostream> | |
using namespace std; | |
bool isInt(char tempNumber); | |
int main() | |
{ | |
char tempNumber[10]; | |
while ( true ) |
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
<div class="toggle"> | |
<a href="#" class="read-more">Read more</a> | |
<div class="hidden hiding" style="display:none">This text toggles back and forth</div> | |
</div> |
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 orderBySubArray( &$array, $new_key = 'order', $order = 'ascending', $start_at = 1 ) | |
{ | |
$output = array(); | |
$count = count( $array ); | |
$i = ( $order == 'ascending' ) ? $start_at : $count; | |
for ( $j = 1; $j <= $count; $j++ ) | |
{ |
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
/** | |
* Martyn Chamberlin | |
*/ | |
import java.util.Scanner; | |
import java.util.ArrayList; | |
import java.util.Random; | |
/** | |
* In true purist fashion, every field in this class is set to private, and more |
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 | |
/** | |
* Just paste this code into your theme's functions.php. When the user submits the form, the | |
* input fields (specified by $fields array) goes into a bunch of cookies. Once the person is | |
* actually logged in and has a wp_users row associated with then, we then take this cookie | |
* data and associated it with their account via the user_meta API. Lastly we delete the cookies. | |
*/ | |
function move_data_from_wl_to_wp() | |
{ | |
$fields = array( 'state', 'county', 'address1', 'address2', 'city', 'zip' ); |
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 | |
/** | |
* Often times in development, I find it convenient to test something out in | |
* the rough before I actually implement it in the software I'm working on. | |
* Usually this is to get the parameters and "ropes" of a built-in function | |
* into my head before testing it in a real (i.e., more moving parts, and | |
* therefore more difficult to debug) environment. I do this in whatever | |
* language I happen to be working in — whether that be Java, C#, or PHP. | |
* | |
* In terminal, you can run `php -a` to simulate a quick PHP test. That is |
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 | |
$using_ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_PORT'] == 443; | |
add_action('wp', 'check_ssl'); | |
function check_ssl() | |
{ | |
// All pages must be https. Redirect to https if not already | |
if (! $using_ssl) | |
{ | |
header('HTTP/1.1 301 Moved Permanently'); |