Skip to content

Instantly share code, notes, and snippets.


Érico Vieira Porto ericoporto

View GitHub Profile
bdsl / matt-Hancock-mp-We must all do everything in our power to protect
Last active Mar 17, 2020
We must all do everything in our power to protect lives - Matt Hancock MP Secretary of State for Health and Social Care - The Telegraph 14 Mach 2020
View matt-Hancock-mp-We must all do everything in our power to protect
GODOT="/Applications/ --path ${PROJ}/src"
View testfullscreen.c
#include <stdio.h>
#include <SDL2/SDL.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
static int count = 0;
static SDL_Surface* screen = NULL;
static SDL_Texture* sdlTexture = NULL;
static SDL_Renderer* sdlRenderer = NULL;
View strings 1 - Why COW is ungood for std string\strings 1 - Why COW is ungood for std string .md

Why COW was deemed ungood for std::string.

COW, short for copy on write, is a way to implement mutable strings so that creating strings and logically copying strings, is reduced to almost nothing; conceptually they become free operations like no-ops.

Basic idea: to share a data buffer among string instances, and only make a copy for a specific instance (the copy on write) when that instance's data is modified. The general cost of this is only an extra indirection for accessing the value of a string, so a COW implementation is highly desirable. And so the original C++ standard, C++98, and its correction C++03, had special support for COW implementations, and e.g. the g++ compiler's std::string implementations used COW.

So why was that support dropped in C++11?

In particular, would the same reason or reasons apply to a reference counted immutable string value class?

gcatlin / sdl-metal-example.m
Last active Jan 24, 2021
Minimal C SDL2 Metal example
View sdl-metal-example.m
// cc sdl-metal-example.m `sdl2-config --cflags --libs` -framework Metal -framework QuartzCore && ./a.out
#include <SDL.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
int main (int argc, char *args[])
WesThorburn /
Last active Feb 5, 2021
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone
  • Enter the cloned directory: cd emsdk
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./
  • Configure emsdk in your bash profile by running: echo 'source "/home/user/emsdk/"' >> $HOME/.bash_profile
dougbinks / ImGuiUtils.h
Created Nov 18, 2017
ImGuiUtils.h with TextURL
View ImGuiUtils.h
#pragma once
#include "RuntimeImGui.h"
#include "RuntimeInclude.h"
#include "IconsFontAwesome.h" // from
#include "PlatformUtils.h"
namespace ImGui


Our app relies entirely on the current_user helper method (found in our ApplicationController) to retrieve the User object associated with the currently logged-in user (if any). You guys are using the devise gem for authentication, but you still have a current_user helper method which is made available to ApplicationController (and all subclasses).

Normally, the current_user method looks something like this:

def current_user
  # do some magic to get the user id from the (encrypted) session cookie…
  user_id = get_user_id_from_session
SamDarbonne /
Last active Sep 15, 2016
Week 1 Learning Objectives

Week 1 Learning Objectives

###Git & Github

  • Explain the uses of Git and GitHub for tracking their changes and collaborating on projects.
  • Draw a model of local, remote, and working copies of their repositories.
  • Write some code, commit the changes, and write a strong commit message.
  • Deploy first live website using gh-pages.


harold-b / dear imgui, selectable popup example
Created Aug 6, 2016
A functional selectable pseudo-popup window example using dear imgui, for use with autocomplete or input history.
View dear imgui, selectable popup example
const int ENTRY_COUNT = 10;
const char* ENTRIES[ENTRY_COUNT] =
"Entry 0",
"Entry 1",
"Entry 2",
"Entry 3",
"Entry 4",
"Entry 5",