Skip to content

Instantly share code, notes, and snippets.

View alvaro893's full-sized avatar

Álvaro Bolaños Rodríguez alvaro893

View GitHub Profile
@alvaro893
alvaro893 / child.css
Last active August 29, 2015 14:21
TwentyThirteen Child theme for my web
/*
Theme Name: TwentyThirteen Child
Description: My modification of TwentyThirteen
Author: Alvaro Bolaños Rodriguez
Version: 1.0
License: The MIT License (MIT)
License URI: http://opensource.org/licenses/MIT
Template: twentythirteen
*/
@alvaro893
alvaro893 / activate_display_branch_git.sh
Last active August 29, 2015 14:24
Enable to display git branch in the command prompt.
# Append this code to the .bashrc file
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
@alvaro893
alvaro893 / remotePostgre.md
Last active August 29, 2015 14:24
Enable remote access to postgre

1

  • Access the following file
    $ vi /etc/postgresql/9.3/main/pg_hba.conf
  • Add the any ip range at the end:
    host all all 192.168.123.0/24 trust

2

  • Go to
    $ vi /etc/postgresql/9.3/main/postgresql.conf
  • Modify this line
@alvaro893
alvaro893 / gist:c2d6df70a51853964233
Created August 7, 2015 08:10
Fix VirtualBox Windows 10 issue
UPDATE Alternative solution by @pdcmoreira:
I found a VERY SIMPLE way to make it work without touching any file in the accepted answer!
Install and run this file: https://www.virtualbox.org/attachment/ticket/14040/VBox-Win10-fix-14040.exe (leave it running in the background) Go to the C:\Program Files\Oracle\VirtualBox folder, right click on VirtualBox.exe, go to compatibility, check the "Run in compatibility mode" checkbox and choose Windows 7. Click OK to close the window. Repeat step 2. for VBoxManage.exe and VBoxHeadless.exe Run cmd and do homestead up. There you go! It should work!
After all is done and working, close the program opened in step 1.
Source: https://laracasts.com/discuss/channels/general-discussion/windows-10-vagrant-virtualbox-homestead/?page=5
@alvaro893
alvaro893 / mysql-commands.md
Last active December 5, 2015 02:17
Dealing with mysql commands

Install

sudo apt-get install mysql-server

install phpmyadmin

sudo apt-get install phpmyadmin
Add this if it is not working in localhost/phpmyadmin
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-enabled/001-phpmyadmin && sudo service apache2 restart

Commands

  • open shell sudo mysql -u root -p
  • display information:
@alvaro893
alvaro893 / Crontab.md
Last active October 27, 2015 10:41
Command to run scripts at certain times

Normal use

This is the format of /etc/crontab:

# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

| | | | |

@alvaro893
alvaro893 / mongodb.md
Last active November 28, 2015 21:29
Mongo commands

turn on database

mongod

access database

mongo

Some useful commands

use namedb
show dbs
show collections

insert

db.collection.insert({})

@alvaro893
alvaro893 / Login with SSH keys.md
Last active November 30, 2015 10:21
Login to a Linux server using ssh keys instead passwords
  1. In your client machine: create a new private/public key using ssh-keygen command, tt will create both keys in your .ssh folder. Or use puttygen:

  2. click generate

  3. save the private key

  4. copy the public key from the text box (don't save the public key from puttygen). you can reopen the private key and see its public-key later

  5. In the server copy the public key text into .ssh/authorized_keys file

  6. configure putty to use your created private key in connection->ssh->auth Or use: ssh -i privatekeypath user@server.com

@alvaro893
alvaro893 / open_soft_keyboard_android.java
Last active February 8, 2016 14:11
Forces to Open the soft keyboard in Android
InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
/**
* Also you can add this to the Manifiest file:
* android:windowSoftInputMode="stateVisible"
* inside of the <activity> you want
* /
@alvaro893
alvaro893 / ViewController.h
Last active May 14, 2016 09:42
objetive-c example for apple app
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *waterTextField;
@property (weak, nonatomic) IBOutlet UITextField *ratioTextField;
@property (weak, nonatomic) IBOutlet UITextField *coffeeTextField;
- (IBAction)calculateButtonPressed:(id)sender;