Skip to content

Instantly share code, notes, and snippets.

View raphaelchaib's full-sized avatar

Raphael Chaib raphaelchaib

View GitHub Profile
@raphaelchaib
raphaelchaib / 01-overview.md
Last active March 4, 2016 06:19
WordPress: Fixing file permissions

Overview

All files should be owned by your user account, and should be writable by you. Any file that needs write access from WordPress should be writable by the web server, if your hosting set up requires it, that may mean those files need to be group-owned by the user account used by the web server process.

/

The root WordPress directory: all files should be writable only by your user account, except .htaccess if you want WordPress to automatically generate rewrite rules for you.

/wp-admin/

The WordPress administration area: all files should be writable only by your user account.

@raphaelchaib
raphaelchaib / functions.php
Created February 5, 2016 07:33
WordPress: Remove "Protected/Protegido" from post title
<?php
add_filter('protected_title_format', 'blank');
function blank($title) {
return '%s';
}
@raphaelchaib
raphaelchaib / watchlist.php
Created December 21, 2015 05:35
Sync IMDb watchlist to trakt.tv watchlist. Usage: php -f watchlist.php trakt_apikey trakt_username trakt_passwordhash imdb_login imdb_password imdb_uid (IMDb login is email adress or nickname, it's NOT the ur12345678 bit, that's the imdb_uid)
<?php
define('TRAKT_APIKEY', $argv[1]);
define('TRAKT_USERNAME', $argv[2]);
define('TRAKT_PASSWORD', $argv[3]);
define('IMDB_EMAIL', $argv[4]);
define('IMDB_PASSWORD', $argv[5]);
define('IMDB_UID', $argv[6]);
function curl_post($urlpre, $data, $urlpost = '')
@raphaelchaib
raphaelchaib / git-commands.md
Last active June 22, 2016 18:29
Essential Git Commands

Essential Git Commands

Remove all items from Index, respecting Git ignore

The series of commands below will remove all of the items from the Git Index (not from the working directory or local repo), and then updates the Git Index, while respecting git ignores. PS. Index = Cache

First:

@raphaelchaib
raphaelchaib / open_scholar_setup.sh
Created November 22, 2015 02:10
Setup OpenScholar on EC2
#!/bin/sh
#Ravi Menon
#20/Aug/2014
MYSQL_ROOT_PASSWD=~/.mysql_root
install_dependencies() {
#Refresh Ubuntu package list
sudo apt-get update

###Init

  1. Spawn Ubuntu instance.
  2. Update aptitude with sudo apt-get update
  3. Install junk we want sudo apt-get install nginx spawn-fcgi php5 php5-cli php5-common php5-suhosin php5-cgi php-pear php5-mysql htop git
  4. Set root password sudo passwd root

###Setup PHP

  1. Change /etc/nginx/sites-available/default to:
server {
@raphaelchaib
raphaelchaib / Setup.md
Created November 22, 2015 02:02 — forked from suvozy/Setup.md
Setup AWS EC2 and RDS (php5.5, apache2.4, mysql5.5, phpmyadmin)
@raphaelchaib
raphaelchaib / functions.php
Created November 13, 2015 14:19
WordPress: Permite o envio de e-mails pela Locaweb adicionando configurações específicas
<?php
/*
A hospedagem é Locaweb? ou Revenda nova Locaweb? Está com problemas?
No plugin Contact Form 7:
Configurar o campo DE com o e-mail da própria locaweb (seu_email@seu_dominio.com.br).
Em "Cabeçalhos adicionais", inserir:
Reply-To: [email-315] (Alterar este shortcode para a id da sua tag)
Return-Path: [email protected]
@raphaelchaib
raphaelchaib / gist:fcacdd4e4b2e527b122c
Created November 9, 2015 19:00
RegExp: Select the last dot in the string
.([^.]*)$
@raphaelchaib
raphaelchaib / script.js
Last active October 21, 2015 03:27
jQuery Validation: Change default messages
jQuery.extend(jQuery.validator.messages, {
required: "This field is required.",
remote: "Please fix this field.",
email: "Please enter a valid email address.",
url: "Please enter a valid URL.",
date: "Please enter a valid date.",
dateISO: "Please enter a valid date (ISO).",
number: "Please enter a valid number.",
digits: "Please enter only digits.",
creditcard: "Please enter a valid credit card number.",