Skip to content

Instantly share code, notes, and snippets.

View ronsuez's full-sized avatar

Ronald Suez ronsuez

View GitHub Profile
//http function promise example
function getPackages(){
var deferred = $q.defer();
$http.get(BaseApiUrl + '/packages/')
.success(function(data, status, headers, config) {
deferred.resolve(data.results);
})
.error(function(status) {
Remove existing files from the repository:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
find . -iregex ".*\.\(pyc\)" -print0 | xargs -0 git rm -f --ignore-unmatch
Add the line
.DS_Store
to the file .gitignore, which can be found at the top level of your repository (or created if it isn't there already). Then
git add .gitignore

Install portaudio using homebrew (or method of your choice)

brew install portaudio

create $HOME/.pydistutils.cfg using the include and lib directories of your portaudio install:

[build_ext]
@ronsuez
ronsuez / install.sh
Created June 2, 2015 14:28
brew base libraries
brew install autoconf
brew install automake
brew install libtool
brew install apple-gcc42
brew install libyaml
brew install libxslt
brew install libksba
brew install openssl
@ronsuez
ronsuez / phpmyadmin.conf
Created May 10, 2015 00:39
Nginx phpmyadmin.conf file
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
server_name phpmyadmin.example.loc;
root /var/www/vhosts/pma/;
index index.php;
@ronsuez
ronsuez / config_psql_osx
Created May 9, 2015 20:18
Config Postgresql on Yosemite OSX
After install postgresql on mac os x, generally you need to do the following things:
you need to replace the /usr/lib/libpq.5.dylib library because its version is too old.
Here's my solution to this problem:
$ sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old
$ sudo ln -s /Library/PostgreSQL/9.4/lib/libpq.5.dylib /usr/lib
@ronsuez
ronsuez / steps
Created May 4, 2015 21:27
django-gunicorn-supervisord
1.- ssh into the vps
2.- create a new virtualenv
3.- clone the repository
4.- install the needed dependencies (through the requeriments file)
5.- check the database connection and then migrate the models
6.- config static folder and collectstatic
6.- configure gunicorn/supervisord
7.- configure nginx reverse proxy
@ronsuez
ronsuez / reverse-proxy-conf
Created April 15, 2015 07:37
Nginx Reverse Proxy Template
server {
listen 80;
server_name server_name;
location / {
proxy_set_header Host $host;
proxy_set_header X-REAL-IP $remote_addr;
proxy_pass http://host:port/;
proxy_buffering off;
}
@ronsuez
ronsuez / gist:034ab91cc0e878b6bd60
Last active August 29, 2015 14:17
PHPExcel - Read File
public function readExcel(){
// Include PHPExcel_IOFactory
App::import('Vendor', 'Classes/PHPExcel');
$inputFileName = "../Vendor/phpExcel/docs/vacas-empleados.xlsx";
// Read your Excel workbook
@ronsuez
ronsuez / gist:94dcff8de42851e6353b
Last active August 29, 2015 14:17
PHPExcel Basic Usage - Template importing
<?php
// Importamos la clase PHPExcel
App::import('Vendor', 'Classes/PHPExcel');
$locale = 'es';
$validLocale = PHPExcel_Settings::setLocale($locale);
if (!$validLocale) {
echo 'Unable to set locale to '.$locale." - reverting to en_us<br />\n";
}