Skip to content

Instantly share code, notes, and snippets.

@martintamare
martintamare / listener.cpp
Created January 4, 2011 16:24
Ogre 3D Listener that I used to program multi-touch interactions
#include "listener.h"
//--------------------------------
// GLOBAL FOR LEVMAR
//--------------------------------
std::map<int,Vector3> mapPoint3DToMatch;
std::map<int,Vector2> mapPoint2D;
Vector3 vCentreObject = Vector3::ZERO; // Center of rotation ?
Vector3 vCentreRotation = Vector3::ZERO;
Camera * gmCamera; // Camera use to project
@tmiz
tmiz / build_openssl_dylib.sh
Last active November 1, 2023 13:18
Build latest OpenSSL Universal Binary on OSX
#!/bin/bash
OPENSSL_VERSION="1.0.1g"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386
@ciembor
ciembor / gist:1494530
Created December 18, 2011 21:28
RGB to HSL and HSL to RGB conversion functions
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
typedef struct rgb {
float r, g, b;
} RGB;
typedef struct hsl {
float h, s, l;
} HSL;
@johngian
johngian / dijkstra.cpp
Created February 14, 2012 00:03
Dijkstra in C++ using STL
#define MAX 999999999
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
class compare
@benvium
benvium / sendFileFromDocumentFolderViaEmail.m
Created May 11, 2012 08:53
Sending a file as an attachment via email from an iOS app. Add to a ViewController subclass
// NOTE YOU MUST ADD THE FRAMEWORK 'MessageUI' to your project.
// MyViewController.h
//-------------------
#import <MessageUI/MessageUI.h>
@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>
// MyViewController.m
@PhirePhly
PhirePhly / memdjpeg.c
Created July 10, 2012 02:33
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@4poc
4poc / gist:3155033
Created July 21, 2012 07:56
C++11 variadic template printf with boost::format
#include <boost/format.hpp>
void LogMessage(boost::format& message) {
std::cout << message.str() << std::endl;
}
template<typename TValue, typename... TArgs>
void LogMessage(boost::format& message, TValue arg, TArgs... args) {
message % arg;
LogMessage(message, args...);
@reactormade
reactormade / hidpi.txt
Last active October 9, 2015 15:58 — forked from simX/hidpi.txt
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
//enable HiDPI modes
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
//revert to default
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
@nikolaykasyanov
nikolaykasyanov / jpeg_memory_src.c
Created October 24, 2012 14:07
Memory source for libjpeg-turbo
#include "jpeg_memory_src.h"
/// JPEG source manager
struct jpeg_source_t
{
struct jpeg_source_mgr _pub;
const char *_begin;
const char *_end;
};
@willryanuk
willryanuk / ZUISwitch.h
Created October 26, 2012 11:41
This is a UISwitch with a block based hander for value change control events
//
// ZUISwitch.h
// zeebox
//
// Created by Will on 26/10/2012.
// Copyright (c) 2012 Electric Labs. All rights reserved.
//
@interface ZUISwitch : UISwitch