Skip to content

Instantly share code, notes, and snippets.


Piero Dotti ProGM

View GitHub Profile
ProGM /
Last active Nov 5, 2020
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.


posts =
posts = Post.arel_table # ActiveRecord

Table alias

View BDD-steps.xml
<?xml version="1.0" encoding="UTF-8"?>
ProGM /
Created Mar 6, 2019
Check differences between two folders in bash
#!/usr/bin/env bash
tmpfile1=$(mktemp /tmp/report.XXXXXX)
tmpfile2=$(mktemp /tmp/report2.XXXXXX)
cd "$1"
find . >> $tmpfile1
cd "$2"
find . >> $tmpfile2
ProGM /
Last active Mar 6, 2019
Delete files from a google drive folder via command line
# Delete all files in the drive folder, excluding google docs
find . -type f \( ! -iname "*.gdoc" -and ! -iname "*.html" -and ! -iname "*.gsheet" -and ! -iname "*.gdraw" -and ! -iname "*.gslides" -and ! -iname "*.gform" -and ! -iname "*.gtable" -and ! -iname Icon\? \) -delete
ProGM / example.js
Last active Sep 3, 2017
Example indiexpo API implementation in Javascript
View example.js
* An usage example of the previous library
function loadData() {
// Send score 1
indiexpo.sendScore(1).then(function(data) {
console.log('score sent, response:', data);
// Get current user username
ProGM / main.rb
Last active Jun 19, 2017 — forked from coorasse/main.rb
CanCanCan Issue when compiling SQL using `accessible_by`
View main.rb
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
gemfile(true) do
source ''
gem 'rails', '5.1.1' # use correct rails version
ProGM / .bash_prompt
Created Feb 8, 2017
Customized dotfiles
View .bash_prompt
# Customized dotfiles. Original credits:
# Shell prompt based on the Solarized Dark theme.
# Screenshot:
# Heavily inspired by @necolas’s prompt:
# iTerm → Profiles → Text → use 13pt Monaco with 1.1 vertical spacing.
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
ProGM / CheckMissingReferencesInUnity.cs
Last active Nov 23, 2020
Finding Missing References in Unity 5.4+
View CheckMissingReferencesInUnity.cs
// Based on
// It fixes deprecations and checks for missing references every time a new scene is loaded
// Moreover, it inspects missing references in animators and animation frames
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.Linq;
View FloodFill.cs
using UnityEngine;
using System.Collections.Generic;
// Flood Fill implementation for Unity3D C#
// Used in:
public static class ImageUtils
public struct Point {
ProGM / ExampleBehavior.cs
Created Oct 19, 2016
A PropertyDrawer to show a popup field with a generic list of string for your Unity3d attribute
View ExampleBehavior.cs
public class MyBehavior : MonoBehaviour {
// This will store the string value
[StringInList("Cat", "Dog")] public string Animal;
// This will store the index of the array value
[StringInList("John", "Jack", "Jim")] public int PersonID;
// Showing a list of loaded scenes
[StringInList(typeof(PropertyDrawersHelper), "AllSceneNames")] public string SceneName;
You can’t perform that action at this time.