Skip to content

Instantly share code, notes, and snippets.

@arrieta
arrieta / lexer.cpp
Last active December 10, 2024 15:57
Simple C++ Lexer
// A simple Lexer meant to demonstrate a few theoretical concepts. It can
// support several parser concepts and is very fast (though speed is not its
// design goal).
//
// J. Arrieta, Nabla Zero Labs
//
// This code is released under the MIT License.
//
// Copyright 2018 Nabla Zero Labs
//
@gregkepler
gregkepler / AnimatedGif.cpp
Last active December 7, 2015 20:46
Cinder Simple Animated Gif Player class
#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
hosaka / jump_table.cpp
Created August 10, 2015 16:34
Jump table example using function pointers in C++
#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");}
//
// Music Player
// This class will stream an MP3 file over HTTP using the Direct Show API
//
//////////////////////////////
//
// MusicPlayer.h
//
@roxlu
roxlu / fun.cpp
Last active January 5, 2021 08:52 — forked from kizzx2/fun.cpp
Using lua 5.2 with C++
// fun.cpp
// This is for Lua 5.2, for Lua 5.1, see https://gist.github.com/kizzx2/1594905
#include <lua.hpp>
#include <iostream>
#include <sstream>
class Foo
{
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active December 24, 2024 07:22
GLSL Noise Algorithms
@Lerg
Lerg / utils.lua
Last active August 23, 2022 20:09
local mRandom = math.random
local tInsert = table.insert
local app = require('lib.app')
-------------------------------------------
-- Shuffle a table
-------------------------------------------
table.shuffle = function (t)
local n = #t
while n > 2 do
-- n is now the last pertinent index
@douglas-vaz
douglas-vaz / graph_search.cpp
Created March 2, 2013 19:57
Breadth First Search and Depth First Search in C++
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
class Node{
@taxilian
taxilian / USBNotify.cpp
Created December 16, 2011 18:24
Example of receiving WM_DEVICECHANGE in a plugin
#include <set>
#include "USBNotify.h"
USBNotify::USBNotify()
{
}
USBNotify::~USBNotify()
{
@shahpoojan
shahpoojan / usb.cpp
Created July 6, 2011 12:57
A code to send data on the USB port for Windows
#include <iostream>
#include <string>
#include <Windows.h>
#include <tchar.h>
#include <stdio.h>
#include <Winbase.h>
HANDLE hCom;
DWORD sendData (const char* data, DWORD size)