Skip to content

Instantly share code, notes, and snippets.

gregkepler / AnimatedGif.cpp
Last active Dec 7, 2015
Cinder Simple Animated Gif Player class
View AnimatedGif.cpp
#include "AnimatedGif.h"
using namespace ci;
using namespace ci::app;
using namespace std;
void AnimatedGif::init( ci::DataSourceRef filePath, int frameRate ){
if( filePath ){
load( filePath );
hosaka / jump_table.cpp
Created Aug 10, 2015
Jump table example using function pointers in C++
View jump_table.cpp
#include <cstdio>
using namespace std;
// function table/jump table example
// various functions that need to be jumped to
void fa() {printf("function a\n");}
void fb() {printf("function b\n");}
void fc() {printf("function c\n");}
void fd() {printf("function d\n");}
View Dshow Remote MP3 Stream
// Music Player
// This class will stream an MP3 file over HTTP using the Direct Show API
// MusicPlayer.h
roxlu / fun.cpp
Last active Jan 5, 2021 — forked from kizzx2/fun.cpp
Using lua 5.2 with C++
View fun.cpp
// fun.cpp
// This is for Lua 5.2, for Lua 5.1, see
#include <lua.hpp>
#include <iostream>
#include <sstream>
class Foo

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
View utils.lua
local mRandom = math.random
local tInsert = table.insert
local app = require('')
-- Shuffle a table
table.shuffle = function (t)
local n = #t
while n > 2 do
-- n is now the last pertinent index
douglas-vaz / graph_search.cpp
Created Mar 2, 2013
Breadth First Search and Depth First Search in C++
View graph_search.cpp
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
class Node{
taxilian / USBNotify.cpp
Created Dec 16, 2011
Example of receiving WM_DEVICECHANGE in a plugin
View USBNotify.cpp
#include <set>
#include "USBNotify.h"
shahpoojan / usb.cpp
Created Jul 6, 2011
A code to send data on the USB port for Windows
View usb.cpp
#include <iostream>
#include <string>
#include <Windows.h>
#include <tchar.h>
#include <stdio.h>
#include <Winbase.h>
DWORD sendData (const char* data, DWORD size)