Skip to content

Instantly share code, notes, and snippets.

View marinho's full-sized avatar

Mario Brandao marinho

  • stuff stuff @ SAP
  • Berlin, Germany
View GitHub Profile
@marinho
marinho / UnityBuildForMultiplePlatforms.cs
Created February 17, 2022 06:16
A class and script to build a game in Unity project to multiple platforms at once, either by one click Unity main menu, or via command line call. In fact, this with these utilities, I'm able to build more often and find building issues earlier than if I did it manually.
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
public class UnityBuildForMultiplePlatforms : MonoBehaviour
{
@marinho
marinho / UniyGameScenesInBulk.cs
Created February 17, 2022 06:11
Class to add all scenes in a Unity project into build settings. This is simpler than adding them manually one by one using UI.
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.ComponentModel;
using System.Diagnostics;
import json
class LevelCreator(object):
_json_obj = None
_file_name = str()
_level_id = str()
_source_layer_id = str()
_output_layer_id = str()
_next_uid = int()
_tile_size = 16 # px
@marinho
marinho / project-paths-into-geo.ts
Last active January 19, 2018 08:17
Projection of a plain polygon (with paths) into a geographic area (including rotation)
/** This code was written as a solution for the following Stack Overflow entry:
* https://stackoverflow.com/questions/48307362/draw-a-multi-polygon-with-metric-dimensions-over-part-of-a-sphere-using-d3-geo/48336677
*
* Even though it seems to work fine, this code has at least 2 needs for improvements:
* - some of the types and functions here actually exist in existing libraries and could be used from them instead
* - d3-geo's mercator projection inverted should be able to do the same job more elegantly, in combination with
* other d3-geo features
*/
import * as turf from '@turf/turf'; // https://npmjs.com/package/@turf/turf
# coding=utf-8
from __future__ import print_function
from datetime import date, datetime
# --------------- Helpers that build all of the responses ----------------------
def build_speechlet_response(title, output, reprompt_text, should_end_session):
return {
@marinho
marinho / alexa-skill-wer-ist-mario.py
Last active June 24, 2017 05:02
Alexa skill "Wer ist Mario?"
"""
This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well
as testing instructions are located at http://amzn.to/1LzFrj6
For additional samples, visit the Alexa Skills Kit Getting Started guide at
http://amzn.to/1LGWsLG
"""
from __future__ import print_function
@marinho
marinho / FractionCalculator.scala
Last active June 14, 2017 21:19
Playing with implicit conversions and infix in Scala
import scala.language.implicitConversions
import scala.language.postfixOps
// numerator
// ( numerator ÷ denominator ) create a fraction object as -----------
// denominator
object Main extends App {
implicit def intToFraction(i: Int) = new IntWithFraction(i)
@marinho
marinho / app-tsconfig.json
Created January 18, 2017 09:25
Issue when installing Angular 2 library
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmitHelpers": true,
@marinho
marinho / gulpfile.js
Created November 5, 2016 15:02
New gulpfile.js for sc5-stylesheet
var gulp = require('gulp');
var styleguide = require('sc5-styleguide');
var sass = require('gulp-sass');
const projectTitle = 'C4RE Style Guide';
const sourcePath = 'src';
const outputPath = 'output';
const styleSourcePath = sourcePath + '/styles';
const scssRoot = styleSourcePath + '/tutorial.scss';
const scssWild = styleSourcePath + '/**/*.scss';
@marinho
marinho / gulpfile.js
Created November 5, 2016 13:40
sg-wrapper not working in sc5-styleguide
// Imports
var gulp = require('gulp');
var sass = require('gulp-sass');
var styleguide = require('sc5-styleguide');
// Path definitions
var sourcePath = 'src';