Skip to content

Instantly share code, notes, and snippets.

Emilio Silvas esilvas

View GitHub Profile
@esilvas
esilvas / postgres-create-list-role.markdown
Last active Dec 26, 2015
Postgres create role/user and generate list
View postgres-create-list-role.markdown

CREATE USER davide WITH PASSWORD 'jw8s0F4';

SELECT rolname FROM pg_roles;

@esilvas
esilvas / Word-wrap.markdown
Created Dec 12, 2012
Word wrap with new-lines
View Word-wrap.markdown
public function pdf_word_wrap( $text = '', $line_length = 60 )
{
	    if($text) 
	    {
        $tmp_text = '';
		    $tmp_text_array = array();

		    $total_chars = strlen($text);
		    $text_array = explode(' ', $text);
View mysql-import.markdown

Import MySQL Database File (large or small)

MySQL Prompt

In order to import data dump files, I have started using the native MySQL import feature from within the application.

Login to MySQL:

$ mysql -umyuser -pmypassword
View useful-git-commands.markdown

Useful Git Commands

Setup Git Global Variables

Copied from Github: https://help.github.com/articles/set-up-git

Tell git your name:

$git config --global user.name "Your Name Here"
# Sets the default name for git to use when you commit

Tell git your email address:

View enable-php-short-tags.markdown

PHP Short Tags

Go to your php.ini file and set:

short_open_tag=On

Restart Apache and start using PHP short tags.

@esilvas
esilvas / mountain-lion-brew-setup.markdown
Created Jul 30, 2012 — forked from myobie/mountain-lion-brew-setup.markdown
Fix Homebrew after Mountain Lion Upgrade
View mountain-lion-brew-setup.markdown

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

You can’t perform that action at this time.