Skip to content

Instantly share code, notes, and snippets.

View imjacobclark's full-sized avatar
:shipit:
Shipping

Jacob Clark imjacobclark

:shipit:
Shipping
  • Manchester, United Kingdom
  • 03:30 (UTC)
View GitHub Profile
@imjacobclark
imjacobclark / update-checker.php
Created May 12, 2012 23:57
PHP Script Update Checker
<?php
/* Checks for updates using a remote CSV file
* The CSV must be like this
* versionnumber,versiondescription,type,downloadlink
* For the type, critical is 1 none critical is 0
* http://www.fusionstrike.com
*/
$version = "1"; //Version of the script, to check against CSV
$critical = FALSE; //Set Critical Variable to False
@imjacobclark
imjacobclark / upload-form.php
Created May 13, 2012 09:44
Multiple Image Uploader Using MongoDB To Store Image Paths
<form name="newad" method="post" enctype="multipart/form-data" action="uploader.php">
<br/>
<label for="file">Image 1:</label>
<input type="file" name="file" id="file" />
<label for="file">Image 2:</label>
<input type="file" name="file2" id="file2" />
<label for="file">Image 3:</label>
<input type="file" name="file3" id="file3" />
@imjacobclark
imjacobclark / display.php
Created May 17, 2012 21:13
GridFS MongoDB
<?php
$m = new Mongo();
$db = $m->database;
$collection = $db->images;
$cursor = $collection->find();
foreach ($cursor as $obj) {
$unique_id = $obj['test'];
echo "<img src='newupload.php?unique_id=".$unique_id."'>";
}
@imjacobclark
imjacobclark / calc_lib.php
Created June 6, 2012 21:09
OOP Calculator
<?php
class Calc{
public $input;
public $input2;
public $output;
function setInput($int){
$this->input = (int) $int;
}
$(document).ready(function(){
$('.sponsorFlip').one("mouseenter mouseleave",function(){
var elem = $(this);
if(elem.data('flipped'))
{
elem.revertFlip();
elem.data('flipped',false)
}
<?php
try {
$posted_id = $_GET['unique_id'];
$conn = new Mongo;
$db = $conn->thundergallery;
$grid = $db->getGridFS();
$file = $grid->findOne(array('unique_id' => $posted_id));
echo $file->getBytes();
exit;
@imjacobclark
imjacobclark / controller.php
Created July 18, 2012 19:49
MongoDB App for Connecting and Querying a DB
<?php
class Controller {
protected $database;
public function __construct(Mongo $mongo = null, $database = 'teamomattic') {
if (null === $mongo) {
$mongo = new Mongo();
}
$this->db = $mongo->selectDB($database)->users;
<script>
function goCouch(form){
var xmlHttp = false;
try {
var couchURL = form.databaseUrl.value;
var couchPort = form.portNo.value;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", "http://" + couchURL + ":" + couchPort, false );
@imjacobclark
imjacobclark / test.m
Created December 5, 2012 21:11
testing
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor greenColor];
[self.window makeKeyAndVisible];
- (IBAction)buttonPressed:(UIButton *)sender {
NSArray *predictionArray = [[NSArray alloc] initWithObjects:
@"It is certain",
@"It is decididley so",
@"All signs say yes",
@"The stars are not alligned",
@"My reply is no",
@"Better not tell you now",
@"Concentrate and ask again",