Skip to content

Instantly share code, notes, and snippets.

View teledirigido's full-sized avatar

Miguel Garrido teledirigido

View GitHub Profile
@teledirigido
teledirigido / wpinstall.sh
Last active March 26, 2024 10:23
Download and Install Wordpress via WP-CLI
#!/bin/bash
# This bash script works JUST with WP-CLI
# You can get it from here:
# http://wp-cli.org/
#
# If you don't know what to do with this file:
#
# 1) Install wp-cli on your workspace
# 2) Create a file call wpinstall.sh
@teledirigido
teledirigido / newsite.sh
Created August 2, 2014 12:25
Add new website via Bash script. Working with Ubuntu server.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
fi
echo "<VirtualHost *:80>
ServerAdmin [email protected]
ServerName $1
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@teledirigido
teledirigido / _default.scss
Last active November 30, 2022 15:25
Sass Mixins
//============================================================
// Some of this mixins are from:
//
// adamcbrewer: github.com/adamcbrewer
//
// And other places I can't really remember
//
//============================================================
//============================================================
@teledirigido
teledirigido / git-pre-commit-mysql-dump.sh
Last active August 29, 2015 14:09
MySQL dump on pre-commit
#!/bin/bash
# Pre-commit hook to make a mysql dump right before committing and add it to the commit.
#
# Change the following values to suit your local setup.
# Add this file on your .git/hooks/ and name it as 'pre-commit'
#
# The name of a database user with read access to the database.
DBUSER=[dbuser]
@teledirigido
teledirigido / git-post-merge-mysql-update.sh
Created November 14, 2014 00:33
MySQL backup on post-merge
#!/bin/bash
# Post-merge hook to add a mysql db when post-merge occurs.
#
## Change the following values to suit your local setup.
# The name of a database user with read access to the database.
DBUSER=[dbuser]
# The password associated with the above user. Leave commented if none.
DBPASS=[dbpass]
@teledirigido
teledirigido / cs_select.js
Last active August 28, 2018 06:40
CS Select
/*
* NOTE: This script works better with the following CSS file:
* https://gist.github.com/teledirigido/d5e311df185ad23adaf5 (cs_select.scss)
options = {
# REQUIRED div html tag class for the generated input
selector: '.classSelector',
@teledirigido
teledirigido / div_is_on_top.js
Last active August 29, 2015 14:10
Check when divs have reached the top of the window
var custom_menu = {
handle_colors: function(){
// by default this works with $(window).on('load resize scroll')
$('.scroller').on('load resize scroll', function(){
var index_item = custom_menu._get_index(),
class_item = $('.wrapper-milkguard:eq('+index_item+')').data('menu-color')
@teledirigido
teledirigido / cs_sidebar.js
Last active August 29, 2015 14:14
Sticky sidebar.js
/*
* This plugin requires jquery and modernizr :)
* The goal of this plugin is to stick the sidebar on top and bottom when you scroll
* Websites examples:
* http://www.carncot.school.nz/
*
* Example:
*
* var sidebar = new cs_sidebar({
* id: '#main-sidebar',
@teledirigido
teledirigido / .htaccess
Created March 18, 2015 21:51
Compress and Cache files
ExpiresActive On
ExpiresDefault A0
# 1 WEEK - possible to be changed, unlikely
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
ExpiresDefault A604800
</FilesMatch>
# 3 HOUR - core content, changes quickly
<FilesMatch "\.(txt|xml|js|css)$">