Skip to content

Instantly share code, notes, and snippets.

View ijaureguialzo's full-sized avatar
🌍
...

Ion Jaureguialzo Sarasola ijaureguialzo

🌍
...
View GitHub Profile
@ijaureguialzo
ijaureguialzo / ImagenBoton.java
Last active November 22, 2016 23:59
Modificar la imagen de un botón en Java
private boolean o = true;
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
ImageIcon imagenO = new ImageIcon("o.png");
ImageIcon imagenX = new ImageIcon("x.png");
if (o) {
jButton2.setIcon(imagenO);
} else {
@ijaureguialzo
ijaureguialzo / BotonConBorde.swift
Created November 22, 2016 17:17
Botón con borde en Swift
//
// Botón con borde basado en http://stackoverflow.com/a/38154358
//
import UIKit
@IBDesignable class BotonConBorde: UIButton {
@IBInspectable var ancho: CGFloat = 0 {
didSet {
@ijaureguialzo
ijaureguialzo / osx_ramdisk.sh
Last active May 26, 2017 05:47 — forked from jnschulze/osx_ramdisk.sh
Crear y publicar un ramdisk con node.js
#!/bin/bash
# Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB
DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://8388608` # 4 GB
/usr/sbin/diskutil erasevolume HFS+ "RamDisk" $DISK
RAMDISK="/Volumes/RamDisk/ova"
mkdir $RAMDISK
@ijaureguialzo
ijaureguialzo / temas.sh
Created July 12, 2017 15:09
Todos los temas de highlight
#!/bin/bash
TEMAS=`ls -1 /usr/local/share/highlight/themes/ | cut -f 1 -d "."`
for T in $TEMAS
do
highlight -i test.java -O rtf -o $T.rtf --syntax java --font "SF Mono" --style $T --font-size 12
done
@ijaureguialzo
ijaureguialzo / livetemplate.md
Last active November 22, 2018 09:38
Plantilla para para IntelliJ IDEA
java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
@ijaureguialzo
ijaureguialzo / Main.java
Created November 24, 2018 11:23
Tablero de ajedrez
package com.jaureguialzo;
public class Main {
public static void main(String[] args) {
// La mejor visualización se consigue poniendo como fuente de consola el tipo de letra "Arial Unicode MS"
char[][] tablero = {
{'♜', '♞', '♝', '♛', '♚', '♝', '♞', '♜'},
// Segue
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "siguientePantalla" {
let destino = segue.destination as! OtroViewController;
}
}
// Unwind
@IBAction func guardar(segue: UIStoryboardSegue) {
@ijaureguialzo
ijaureguialzo / replica.sh
Created January 15, 2019 13:09
Replica de un disco con rsync
#!/bin/bash
OPCIONES="-a --delete --partial --progress" # Apple rsync
#OPCIONES="-a --delete --partial --info=progress2" # Homebrew rsync
ORIGEN="/Volumes/seagate"
DESTINO="/Volumes/seagate copia"
if [ -e "$ORIGEN" ] && [ -e "$DESTINO" ]
then
@ijaureguialzo
ijaureguialzo / .bash_profile
Created January 15, 2019 20:08
Función para resaltar código desde el portapapeles
function light() {
if [ -z "$2" ]
then
src="pbpaste"
else
src="cat $2"
fi
$src | highlight -O rtf --syntax $1 \
--font "SF Mono" \
@ijaureguialzo
ijaureguialzo / fusionar.sh
Created February 3, 2019 19:04
Fusionar un proyecto Git como una rama independiente en otro
#!/bin/bash
# Los dos proyectos tienen que estar en la misma carpeta
# ./fusionar.sh <individual> <agrupado> <rama> <mensaje_commit>
# ./fusionar.sh miproyecto proyectos nombre_nombre "Nombre y Nombre"
cd "$2"
git remote add $3 "../$1"
git fetch $3
git branch $3