Skip to content

Instantly share code, notes, and snippets.

View Eduruiz's full-sized avatar
🏠
Working from home

Edu Ruiz Eduruiz

🏠
Working from home
  • São Paulo - Brazil
View GitHub Profile
------WebKitFormBoundary5WJNeD3zhUXIUDU8
Content-Disposition: form-data; name="daily_donation_limit"
null
------WebKitFormBoundary5WJNeD3zhUXIUDU8
Content-Disposition: form-data; name="end_ts"
2018-08-31T20:42:00
------WebKitFormBoundary5WJNeD3zhUXIUDU8
Content-Disposition: form-data; name="admin_email"
@Eduruiz
Eduruiz / jquery-hipster.js
Created March 24, 2018 18:46
just a hipster jquery replacement for simple stuff.
$ = document.querySelector.bind(document);
@Eduruiz
Eduruiz / formajax.js
Created February 28, 2018 19:21
google analytics send virtual pageview on ajax request - only works with the new analytics js.
/* It's important to use the new global analytics script, if you are using the old one
* this will not work. The new script looks like this:
*
* <!-- Global site tag (gtag.js) - Google Analytics -->
* <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
* <script>
* window.dataLayer = window.dataLayer || [];
* function gtag(){dataLayer.push(arguments);}
* gtag('js', new Date());
*
@Eduruiz
Eduruiz / .vimrc
Last active September 4, 2017 13:56
in development vimrc, veeery inspired by jeff from his laracast series
set nocompatible " be iMproved, required
so ~/.vim/plugins.vim
let mapleader = ',' "The default is \, but a comma is much better.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Powerline config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@Eduruiz
Eduruiz / backup.sh
Last active August 11, 2017 20:45
VPS backup on dropbox | make a sqldump and copy of html files, zip each one on dropbox folder, and delete older files
#!/bin/bash
#backuping the database
mysqldump -uroot database_name >/root/Dropbox/db/$(date +%F)_bkp.sql
#zipping it
7z a /root/Dropbox/db/$(date +%F)_bkp.7z /root/Dropbox/db/*.sql
#removing non-zipped files
rm -f /root/Dropbox/db/*.sql
#deleting backups older than 15 days
find /root/Dropbox/db/* -mtime +14 -type f -delete
@Eduruiz
Eduruiz / .htaccess
Created July 5, 2017 16:33
redirect everything to single new domain with chosen protocol
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
RewriteCond %{HTTPS} !^on
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
@Eduruiz
Eduruiz / .htaccess
Last active March 14, 2017 14:03
redirect multiple domains to a single one
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.com [OR]
RewriteCond %{HTTP_HOST} ^domain2.com [OR]
RewriteCond %{HTTP_HOST} ^domain3.com [OR]
#if you are redirecting a domain that matchs the
#beggining of the new one, like foo.com to foo.com.bar
#use the regex like:
#RewriteCond %{HTTP_HOST} ^foo.bar$
RewriteCond %{HTTP_HOST} ^domain4.com [OR]
RewriteCond %{HTTP_HOST} ^domain5.com
@Eduruiz
Eduruiz / .htaccess
Last active April 15, 2018 14:05
.htaccess sample for codeigniter with some seo improvements.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond $1 !^(index\.php|assets|google999621f70dbac9aa\.html|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
@Eduruiz
Eduruiz / ssh-tunnel.bash
Last active November 28, 2016 16:54
create an ssh tunnel for mysql connection, pointing port 3306 on the server to port 3307 on the host
ssh -L 3307:localhost:3306 <user>@<server_ip>
@Eduruiz
Eduruiz / .htaccess
Created July 26, 2016 16:33
redirect all urls to new website home
RewriteEngine on
RedirectMatch 301 ^(.*)$ http://website.example.com