Skip to content

Instantly share code, notes, and snippets.

View 3p3r's full-sized avatar
🥦
farming...

Sepehr Laal 3p3r

🥦
farming...
View GitHub Profile
@3p3r
3p3r / EventManager.h
Last active August 29, 2015 14:27
Simple C# Delegate like EventManager in C++11
#include <type_traits>
#include <functional>
#include <typeinfo>
#include <memory>
#include <map>
/*
* @class EventManager
* @brief A simple C# Delegate like class that can host callbacks and
* fire them when the need arises. Callbacks are identified by
@3p3r
3p3r / CopyImageSubData.cpp
Last active August 29, 2015 14:27
Cinder CopyImageSubData (copies one OpenGL texture to another)
#include "CopyImageSubData.h"
#include "cinder/gl/Texture.h"
#include "cinder/gl/Fbo.h"
#include "cinder/gl/gl.h"
namespace cinder { namespace gl {
// The copy function retreival is only tested on Windows but should work
// on other platforms as well.
@3p3r
3p3r / calcNumIndices.h
Created August 19, 2015 16:12
Calculates number of indices needs to be passed to an OpenGL VBO object
// Calculates number of indices needs to be passed to a VBO object.
// Formula's from: https://www.opengl.org/sdk/docs/man2/xhtml/glBegin.xml
// primitive_type can be GL_POINTS, GL_LINES, etc.
unsigned calcNumIndices(unsigned numVertices, GLenum primitive_type)
{
unsigned numIndices = 0;
switch (primitive_type)
{
case GL_LINE_LOOP:
case GL_POINTS:
@3p3r
3p3r / v8-versions.md
Created January 15, 2016 19:53 — forked from domenic/v8-versions.md
V8 versions for embedders

Embedders of V8 should generally use the head of the branch corresponding to the minor version of V8 that ships in Chrome.

Finding the minor version of V8 corresponding to the latest stable Chrome

To find out what version this is,

  1. Go to https://omahaproxy.appspot.com/
  2. Find the latest stable Chrome version in the table
  3. Enter it into the "Translate a Chrome verison to a V8 version" box below the table.
  4. Ignore the last two parts.
@3p3r
3p3r / readme.md
Created May 31, 2016 04:22 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@3p3r
3p3r / ZXingScanner.cs
Last active February 13, 2024 01:44
Zebra Crossing Unity3D WebCam QR Decoder
using ZXing;
using ZXing.Common;
using UnityEngine;
using System.Collections.Generic;
/// <summary>
/// Extremely basic usage of BarcodeDecoder in ZXing
/// library to actively decode QR codes from WebCam.
/// You may download ZXing C# binaries from:
@3p3r
3p3r / ZXingScanner.cs
Last active July 4, 2016 21:03
Zebra Crossing Unity3D WebCam QR Decoder (multi-threaded)
using ZXing;
using ZXing.Common;
using UnityEngine;
using System;
using System.Threading;
using System.Collections.Generic;
/// <summary>
@3p3r
3p3r / install-gcc48-linuxbrew-centos6.md
Created January 27, 2017 19:35 — forked from stephenturner/install-gcc48-linuxbrew-centos6.md
Installing gcc 4.8 and Linuxbrew on CentOS 6

Installing gcc 4.8 and Linuxbrew on CentOS 6

The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. I'd like to use gcc 4.8+. Also, when trying to install Linuxbrew you run into a dependency loop where Homebrew's gcc depends on zlib, which depends on gcc. Here's how I solved the problem.

Note: Requires sudo privileges.

Resources:

@3p3r
3p3r / GLSL-Noise.md
Created February 25, 2017 21:50 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

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);
}
@3p3r
3p3r / FindPackage.cmake
Created July 19, 2017 18:41
A general purpose C++ header-only library finder
# Copyright (c) 2017 sepehr laal (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all