Skip to content

Instantly share code, notes, and snippets.

View miguelSantirso's full-sized avatar

Miguel Santirso miguelSantirso

View GitHub Profile
@miguelSantirso
miguelSantirso / Arkanoid.as
Created August 27, 2012 10:25
Super simple arkanoid in Flex
package pack{
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import mx.core.UIComponent;
public class Arkanoid extends UIComponent
{
// Definir los parámetros del juego
@miguelSantirso
miguelSantirso / bin-simplemerge.sh
Created April 8, 2014 15:21
Custom Git mergetool that opens remote and local with the default app
#!/bin/sh
open $1 # Remote
# open $2 # Local
open $3 # Merged (same as local in most configs)
echo # New line
echo Compare, merge and save.
read -p "Finished (yes/cancel)? " -n 1 -r
echo # (optional) move to a new line
@miguelSantirso
miguelSantirso / gist:10160597
Last active August 29, 2015 13:58
Open file with default app in Ruby
def open_with_default_app path_to_file
if is_windows?
%x{start /MIN #{path_to_file}}
elsif is_mac?
%x{open -g \"#{path_to_file}\"}
elsif is_linux?
%x{xdg-open \"#{path_to_file}\"}
else
puts "Platform not supported: #{RUBY_PLATFORM}"
end
@miguelSantirso
miguelSantirso / gist:10539800
Created April 12, 2014 14:57
Simplified, git-aware prompt
# First, install https://github.com/mikesten/git-aware-prompt
# simplified prompt like “my_folder (develop)$”
export PS1="\W\[$txtcyn\]\$git_branch\[$txtylw\]\$git_dirty\[$txtrst\]\$ "
@miguelSantirso
miguelSantirso / gist:10721083
Created April 15, 2014 10:28
Run command line comands in ruby
%x(echo hi) # Return the stdout, redirect stderr to the program's
@miguelSantirso
miguelSantirso / gist:11087384
Created April 19, 2014 15:19
OS X Terminal batch rename
# Type this directly into terminal
# Renames *.aaa to *.bbb
for file in *.aaa
do
mv "$file" "${file/.aaa/.bbb}"
done
# This works:
@miguelSantirso
miguelSantirso / gist:5912f75725077b5e57c1
Created May 16, 2014 09:43
Change .p12 password without changing the SHA1 fingerprint
# Step 1: Import the .p12 file into a jks keystore
keytool -importkeystore -srckeystore original.p12 -srcstoretype pkcs12 -destkeystore temporal.jks -deststoretype jks
# Step 2: Create the new .p12 file from the temporal .jks keystore
keytool -importkeystore -srckeystore temporal.jks -destkeystore new.p12 -srcstoretype jks -deststoretype pkcs12
# Step 3: Test the new .p12 file
keytool -list -v -keystore new.p12 -storetype pkcs12
@miguelSantirso
miguelSantirso / Collider2DRaycastFilter.cs
Created June 6, 2015 16:32
[Unity] Use a 2D collider to filter clicks on any Unity UI component (Button, Image, etc...)
using UnityEngine;
using UnityEngine.UI;
[RequireComponent (typeof (RectTransform), typeof (Collider2D))]
public class Collider2DRaycastFilter : MonoBehaviour, ICanvasRaycastFilter
{
Collider2D myCollider;
RectTransform rectTransform;
void Awake ()
@miguelSantirso
miguelSantirso / EasyScreenshot.cs
Created January 30, 2016 15:26
Unity: Press 'K' to take screenshots
using UnityEngine;
using System.Collections;
public class EasyScreenshot : MonoBehaviour
{
#region inspector properties
[SerializeField]
private int superSize = 1;
[SerializeField]
private string directory = "screenshots";
@miguelSantirso
miguelSantirso / CameraFixedAspectRatio.cs
Last active February 4, 2016 18:42
[Unity] Fixed aspect ratio camera
using UnityEngine;
using System.Collections;
public class CameraFixedAspectRatio : MonoBehaviour
{
#region inspector properties
[SerializeField]
private float wantedAspectRatio = 1.5f;
[SerializeField]
private Color fillColor = Color.black;