Skip to content

Instantly share code, notes, and snippets.

View derofim's full-sized avatar

Den derofim

  • Google
  • USA
View GitHub Profile
@a-bx
a-bx / copy_git.sh
Created March 8, 2012 14:40
Copy git repositories with all history
#Origin
$ git clone <origin repo>
$ cd <origin directory>
$ git remote rm origin
$ git filter-branch --subdirectory-filter ./ -- --all
$ git add .
$ git commit
$ pwd
#Target
@joni
joni / toUTF8Array.js
Last active May 14, 2024 09:23
toUTF8Array: Javascript function for encoding a string in UTF8.
function toUTF8Array(str) {
var utf8 = [];
for (var i=0; i < str.length; i++) {
var charcode = str.charCodeAt(i);
if (charcode < 0x80) utf8.push(charcode);
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
0x80 | (charcode & 0x3f));
}
else if (charcode < 0xd800 || charcode >= 0xe000) {
@Khaledgarbaya
Khaledgarbaya / Hello_Triangle.cpp
Created October 4, 2014 22:28
Hello Triangle Sample With SDL in OpenGL ES 2 (IOS)
#include "SDL.h"
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#include <iostream>
#include <string>
#include <memory>
using namespace std;
GLuint programObject;
class Graphics
@kwonoh
kwonoh / gl_vertex_attrib_pointer.hpp
Last active February 16, 2017 15:43
Generic glVertexAttribPointer
#ifndef GL_VERTEX_ATTRIB_POINTER_HPP
#define GL_VERTEX_ATTRIB_POINTER_HPP
// Copyright Oh-Hyun Kwon 2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/*
@dberzano
dberzano / CMakeLists.txt
Created January 28, 2015 11:11
CMake: how to use optional arguments in macros and how to escape/unescape args to a shell
cmake_minimum_required(VERSION 2.8)
project(testoptargsandescape)
macro(testmacro testarg1 testarg2)
message(STATUS "testarg1 = \"${testarg1}\"")
message(STATUS "testarg2 = \"${testarg2}\"")
message(STATUS "Optional arg = \"${ARGV2}\"")
@emkooz
emkooz / Model.cpp
Last active January 12, 2017 07:55
Assimp loader
#include "Model.hpp"
bool core::ModelLoader::loadModel(const char* fp, Model* m)
{
core::log("Loading " + (std::string)fp, core::green);
Assimp::Importer importer; // used to import the model
const aiScene* scene = importer.ReadFile(fp,
aiProcess_Triangulate |
@vittorioromeo
vittorioromeo / hello_triangle.cpp
Created October 10, 2015 11:07
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
@mariobadr
mariobadr / game_loop.cpp
Last active May 23, 2024 02:36
A basic game loop using std::chrono
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Mario Badr
*
* 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
@derofim
derofim / Social.md
Last active September 22, 2021 13:39
Cocos 2d js game resources
@derofim
derofim / codestyle.md
Last active May 14, 2024 05:21
C++ code style sample