Skip to content

Instantly share code, notes, and snippets.

View GusGA's full-sized avatar
🕶️
Reading someone else's code

Gustavo Giménez GusGA

🕶️
Reading someone else's code
  • Santiago, Chile
View GitHub Profile
@GusGA
GusGA / Receta.md
Last active October 13, 2015 19:58
Receta de Bruschettas a Lo Gonzo

#Receta para la preparación rápida de Bruschettas a lo gonzo

##Ingredientes

  • Pan Campesino
  • Tomate
  • Tocineta
  • Ajo
  • Perejil
  • Aceite de Oliva
@GusGA
GusGA / ruby_job_interview_questions_es.md
Last active August 4, 2020 13:01
Posibles preguntas de una entrevista de trabajo para Ruby y Ruby on Rails
  1. ¿Qué es request.xhr?
  2. ¿Cuál es la diferencia entre un Scaffolding dinámico y estático?
  3. ¿Cuál es la diferencia entre Symbol y String? Symbol es inmutable y no puede ser modificado a diferencia de un String
  4. ¿Qué es una sesión y una cookie?
  5. ¿Por qué Ruby on Rails?
  6. ¿Qué es MVC y cómo funciona?
  7. ¿Qué cosas puedes definir en el modelo?
  8. ¿Qué es ORM en Rails?
  9. ¿Cuántos tipos de relaciones tiene un modelo?
@GusGA
GusGA / tweetTest.rb
Last active December 11, 2015 08:49
Script de prueba para tuitear el ida de la semana a través de la consola
require 'date'
arreglo = %w(Domingo Lunes Martes Miercoles Jueves Viernes Sabado)
dia = Date.today.wday
puts `t update "Hoy es #{arreglo[dia]}"`
#el comando "t update" es un comando de una gema de ruby para tuitear a traves de la consola
#link del repositorio https://github.com/GusGA/t
@GusGA
GusGA / numeroperfecto.c
Last active December 15, 2015 04:38
Función escrita en C, que valida si un número es perfecto o no.
//Según la teoria:
//Un número perfecto es un número natural que es igual a la suma de sus divisores propios positivos,
//sin incluirse él mismo.
int numeroperfecto (int valor){
int temp = (valor - 1);
int perfecto = 0;
do {
if (valor % temp == 0){
perfecto += temp;
}

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

int inversor_numero (long num){
long n = num, digito;
printf( "El numero %l invertido es: \n", n );
while( n > 0 )
{
digito = n % 10;
n /= 10;
printf( "%l\n", digito );
}
@GusGA
GusGA / Shutcurts.md
Last active December 17, 2015 12:29
Keyboard shortcuts for Shut down, restart, and sleep on Mac

Keyboard shortcuts for Shut down, restart, and sleep

###Control-Eject

The dialog box "Are you sure you want to shut down your computer now?" appears with options to Restart, Sleep, Cancel or Shut Down. After the dialog appears, press the R key to Restart, press the S key to Sleep, press the Esc key to Cancel, or press the Return key to Shut Down.

###Control-Command-Eject

@GusGA
GusGA / copy_file_ssh.md
Created July 6, 2013 04:46
Copiar Archivos via ssh entre equipos

You can do this with the scp command, which uses the ssh protocol to copy files across machines. It extends the syntax of cp to allow references to other systems:

scp username1@hostname1:/path/to/file username2@hostname2:/path/to/other/file

Copy something from this machine to some other machine:

scp /path/to/local/file username@hostname:/path/to/remote/file

Copy something from another machine to this machine:

@GusGA
GusGA / javascript_function_builders.md
Last active December 19, 2015 10:59
3 ways to declare a function in javascript

###Using Function constructor

    var sum = new Function('a','b', 'return a + b;');
    alert(sum(10, 20)); //alerts 30

###Using Function declaration.

    function sum(a, b) 
 {
@GusGA
GusGA / limit_band_width.markdown
Created July 24, 2013 19:24
Limitar el ancho de banda en OSX (recomendable para internet compartido a través de modem móvil)

Let’s assume we want to simulate a 8 KByte/sec limit for port 80

####Step 1 – Define bandwidth rule

sudo ipfw pipe 1 config bw 8KByte/s

####Step 2 – Bind rule to port

sudo ipfw add 1 pipe 1 src-port 80