Skip to content

Instantly share code, notes, and snippets.


Ricardo Amores Hernández rickyah

View GitHub Profile
View MonoBehaviourSingleton.cs
using System;
using UnityEngine;
/// <summary>
/// This is a generic Singleton implementation for Monobehaviours.
/// Create a derived class where the type T is the script you want to "Singletonize"
/// Upon loading it will call DontDestroyOnLoad on the gameobject where this script is contained
/// so it persists upon scene changes.
/// </summary>
/// <remarks>
rickyah / dotnet-format-action.yml
Created Jul 25, 2020
Runs dotnet-format on every PR and create a commit that fixes the formatting if it doesn't comply with your code convention
View dotnet-format-action.yml
name: Format check on pull request
on: pull_request
runs-on: ubuntu-latest
- name: Checkout repo
uses: actions/checkout@v2.2.0
fetch-depth: 0
rickyah /
Last active Apr 3, 2021
Notas de la clase de git para el equipo

# Clase git

## Conceptos básicos


Commits son inmutables

Commits contienen

  • SHA1
rickyah / unity-print-assetbundles.cs
Last active Sep 10, 2020
Script to print all asset bundles of the project and its dependencies
View unity-print-assetbundles.cs
[MenuItem("AssetBundles/Print all Asset Bundle names")]
static void PrintAssetBundlesToDebugConsole()
var sb = new StringBuilder();
var globalTimer = new Stopwatch();
var timer = new Stopwatch();
rickyah / :rails :erb RefineryCms locale navigation
Created Aug 30, 2012 — forked from errorstudio/_locale_nav.html.erb
Refinery CMS: a list of all frontend locales with links
View :rails :erb RefineryCms locale navigation
<% Refinery::I18n.config.frontend_locales.each do |locale| %>
<%= link_to "/#{locale.to_s + request.path}", {:title => Refinery::I18n.locales[locale]} do%>
<span><%= Refinery::I18n.locales[locale] %></span>
<% end -%>
<% end %>
rickyah / :rails Add timestamps to logs
Last active Oct 1, 2015
Add timestamps and more info to default Rails logger
View :rails Add timestamps to logs
# Adds timestamps to logs
# put it at the end of environment.rb
module ActiveSupport
class BufferedLogger
def add(severity, message = nil, progname = nil, &block)
return if @level > severity
message = (message || (block && || progname).to_s
level = {
0 => "DEBUG",
rickyah / podfile_static_lib
Created May 18, 2014
Remove static lib dependencies when the user project for a CocoaPods is an static lib project itself
View podfile_static_lib
# we don't want to link static libs or it will fail to build
# see
targets = [:target1, :target2]
lib_dependencies = ['z']
post_install do |installer| { |i| targets.include? }.each do |l|
config_file_path = l.library.xcconfig_path
config_file_contents =
rickyah / gist:10016780
Last active Aug 29, 2015
View gist:10016780

#C# Properties

Properties are getters & setters but well done.

They require minimal code for setup:

public int MyProperty {get;set;}

This declares a completely functional property. The compiler generates the member to store the property data automatically.

rickyah / gist:10016784
Last active Aug 29, 2015
View gist:10016784

#C# Attributes


Attributes are just meta-data associated to the code.

You can create your own:

  • Create a child class of System.Attribute
  • The name of your attribute class should end with Attribute (convention sufix)