Skip to content

Instantly share code, notes, and snippets.

Avatar
🎮
making

Érico Vieira Porto ericoporto

🎮
making
View GitHub Profile
@bdsl
bdsl / matt-Hancock-mp-We must all do everything in our power to protect lives.md
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 lives.md
View godot-macos-export-and-notarize.sh
#!/bin/bash
PROJ="/path/to/your/project/"
NAME="MyAwesomeGame"
SVER="1.0.0"
GODOT="/Applications/Godot.app/Contents/MacOS/Godot --path ${PROJ}/src"
###
# Mac OSX (RELEASE)
View testfullscreen.c
#include <stdio.h>
#include <SDL2/SDL.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
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
gcatlin / sdl-metal-example.m
Last active Nov 23, 2020
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[])
{
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal");
@WesThorburn
WesThorburn / 1.Instructions.md
Last active Nov 24, 2020
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake
View 1.Instructions.md

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 https://github.com/emscripten-core/emsdk.git
  • 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 ./emsdk_env.sh
  • Configure emsdk in your bash profile by running: echo 'source "/home/user/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
@dougbinks
dougbinks / ImGuiUtils.h
Created Nov 18, 2017
ImGuiUtils.h with TextURL
View ImGuiUtils.h
#pragma once
#include "RuntimeImGui.h"
#include "RuntimeInclude.h"
RUNTIME_MODIFIABLE_INCLUDE;
#include "IconsFontAwesome.h" // from https://github.com/juliettef/IconFontCppHeaders
#include "PlatformUtils.h"
namespace ImGui
View README.md

Overview

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
SamDarbonne / week1-learning-objectives.md
Last active Sep 15, 2016
Week 1 Learning Objectives
View week1-learning-objectives.md

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.

###HTML & CSS

@harold-b
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",
You can’t perform that action at this time.