Skip to content

Instantly share code, notes, and snippets.

View anabelle's full-sized avatar

Anabelle Handdoek anabelle

View GitHub Profile
@anabelle
anabelle / palaproxima.sh
Created September 13, 2012 01:35
Lo que hice para poner a andar pip y virtualenv en crunchbang
# Instala paquetes necesarios
sudo apt-get install postgresql
sudo apt-get install postgresql-server-dev-9.1
sudo apt-get install python-pip
sudo apt-get install python-dev
sudo pip install virtualenv
sudo pip install virtualenvwrapper
# Crea y activa entorno virtual
virtualenv <nombre_proyecto>
@anabelle
anabelle / .gitignore
Created September 4, 2012 18:04
The last .gitignore in h5bp
# Read about how to use .gitignore: http://h5bp.com/ae
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
@anabelle
anabelle / update-wpdb.sql
Created May 11, 2012 06:04
Update WP database after migration to new domain
UPDATE wp_options SET option_value = replace(option_value, 'http://old.tld', 'http://new.tld') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://old.tld','http://new.tld');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old.tld', 'http://new.tld');
@anabelle
anabelle / archive-diff.php
Created May 3, 2012 16:36
Change wordpress post per page limit in a template
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($query_string .'&posts_per_page=12&paged=' . $paged);
?>
<?php
/* Designer randomnes */
if($es_texto == 0 && $texto == 0){
$es_texto = rand(0, 1);
}else{
$es_texto = 0;
}
if($imagen == 2){
$es_texto = 1;
}
find . -type d -print0 | xargs -0 chmod 0755 # For directories
find . -type f -print0 | xargs -0 chmod 0644 # For files
@anabelle
anabelle / f-update-grub.sh
Created January 25, 2012 14:34
Update grub in fedora
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
@anabelle
anabelle / codeigniter_sengrid_parse_api_upload.php
Created January 21, 2012 23:29
Function to get an email using Sendgrid Parse API and save attachments using CodeIgniter
<?php
# CI Reference: http://codeigniter.com/user_guide/libraries/file_uploading.html
# SendGrid Reference: http://docs.sendgrid.com/documentation/api/parse-api-2/
public function input(){
//file upload configuration
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '8192';
$config['max_width'] = '0';
<?php
if (is_uploaded_file($HTTP_POST_FILES['attachmentx']['tmp_name'])) {
copy($HTTP_POST_FILES['attachmentx']['tmp_name'], $HTTP_POST_FILES['attachmentx']['name']);
$subio = true;
}
if($subio) {
echo "El archivo subio con exito";
} else {
echo "El archivo no cumple con las reglas establecidas";
@anabelle
anabelle / github_update.php
Last active November 12, 2016 17:52
github_update.php
<?php $output = shell_exec('git fetch --all && git reset --hard origin/prod'); ?>
<style>
body{
background-color: #1A1A1A;
color:#fff;
}
pre{
padding:20px;
}