Skip to content

Instantly share code, notes, and snippets.

View johnciacia's full-sized avatar
👋

John Ciacia johnciacia

👋
View GitHub Profile
@johnciacia
johnciacia / binary_tree.c
Created November 22, 2012 05:16
Implementation of a Binary Tree
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct node {
struct node *left;
struct node *right;
int val;
} node;
/**
* In wp-config.php: define WP_DEBUG and SAVEQUERIES to true
* Add this code to the bottom of wp-config.php or functions.php
*/
add_action( 'shutdown', function() {
if( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
global $wpdb;
echo "<pre id='queries'>";
echo json_encode($wpdb->queries);
echo "</pre>";
@johnciacia
johnciacia / Base64.h
Created September 3, 2012 18:38
Base64 Encode
#import <Foundation/Foundation.h>
@interface NSString (base64encode)
- (NSString *)base64encode;
@end
@interface NSData (base64encode)
- (NSString *)base64encode;
@end
@johnciacia
johnciacia / alias.sh
Created July 16, 2012 03:51
enable/disable debug
alias endbg="sed -i '' \"s/define('WP_DEBUG', false);/define('WP_DEBUG', true);/g\" wp-config.php"
alias disdbg="sed -i '' \"s/define('WP_DEBUG', true);/define('WP_DEBUG', false);/g\" wp-config.php"
@johnciacia
johnciacia / ViewController.h
Created April 1, 2012 21:20
Send POST Request
//
// ViewController.h
// LoginDemo
//
// Created by John Ciacia on 4/1/12.
// Copyright (c) 2012 Compiled Thoughts. All rights reserved.
//
#import <UIKit/UIKit.h>
<?php
/**
* Calculate the binary value needed to
* display hexidecmal 0-F on a seven-segment
* display for an ARM
*/
(strpos($argv[1], "a") !== false) ? $a = 1 : $a = 0;
(strpos($argv[1], "b") !== false) ? $b = 1 : $b = 0;
(strpos($argv[1], "c") !== false) ? $c = 1 : $c = 0;
@johnciacia
johnciacia / e.c
Created July 18, 2011 22:25
Calculate the value of e as the sum of the infinite series
#include <stdio.h>
/**
* This code will calculate e
* as the sum of the infinite series
* 1/1! + 1/2! + 1/3! + ... + 1/n!
* g++ e.c
* ./a.out
*/
int factorial(unsigned int i);
@johnciacia
johnciacia / bmp.c
Created July 18, 2011 02:28
Encode text in a BMP image format
//because I can...
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
int main(int argc, char **argv) {
if(argc != 3)
<?php
$a = array(3, 2, 1, 5, 9, 0, 7, 4, 6, 8);
while(!is_sorted($a))
shuffle($a);
print_r($a);
@johnciacia
johnciacia / Autocomplete Demo
Created May 14, 2011 19:12
autocomplete.html
<!DOCTYPE html>
<html>
<head>
<title>jQuery Autocomplete Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquer
y-ui.min.js" type="text/javascript"></script>
</head>