Skip to content

Instantly share code, notes, and snippets.

View cesc1989's full-sized avatar
🐻
¿Cuál es la diferencia entre la participación y el compromiso?

Francisco Quintero cesc1989

🐻
¿Cuál es la diferencia entre la participación y el compromiso?
View GitHub Profile
@cesc1989
cesc1989 / README.md
Last active October 11, 2017 17:51 — forked from bsodmike/gist:1369419
Subdomain Routing with Rails 3.1

Implement Routing for Subdomains

Rails 3.0 introduced support for routing constrained by subdomains.

A subdomain can be specified explicitly, like this:

match '/' => 'home#index', :constraints => { :subdomain => 'www' } 
@cesc1989
cesc1989 / 0.md
Created February 26, 2016 17:15 — forked from max-mapper/0.md
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@cesc1989
cesc1989 / web-fonts-asset-pipeline.md
Created January 9, 2016 05:14 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@cesc1989
cesc1989 / 001_provision_ubuntu.sh
Last active September 24, 2017 17:24
Get Linux distro in a ready-to-work state with this bash script.
#!/bin/bash
# First things first, update system
echo "Updating system and installing new packages"
sudo apt-get update
sudo apt-get upgrade
# Install basic dependencies and utilities
echo "Install utilities"
sudo apt-get -y install rar unrar zip unzip
@cesc1989
cesc1989 / bye_double.sh
Last active January 9, 2017 19:00
Find command to delete AppleDouble files and .DS_Store files
#!/bin/bash
find /path/to/folder -depth -name ".DS_Store" -exec rm {} \;
find /path/to/folder -depth -name "._*" -exec rm -Rf {} \;
@cesc1989
cesc1989 / gh_automatic_login.sh
Last active June 17, 2020 19:34
Automaticly ssh-add the github ssh file to avoid typing the passphrase in every boot
#!/usr/bin/expect -f
spawn ssh-add /home/[USER]/.ssh/gh_rsa
expect "Enter passphrase for /home/[USER]/.ssh/gh_rsa:"
send "[PUT-PASSPHRASE HERE]\n";
interact
## Call with command
## expect gh_automatic_login.sh
#Found in:
@cesc1989
cesc1989 / deploy_puma.rb
Last active March 12, 2019 14:02
Deploy with capistrano
# Change these
set :repo_url, '[ENTER YOUR GIT REPO URL HERE]'
set :user, 'macsa'
set :branch, 'test'
set :application, 'staging'
set :puma_threads, [4, 16]
set :puma_workers, 0
@cesc1989
cesc1989 / .htaccess
Created May 26, 2015 14:56
Configuración del .htaccess para los Permalinks en WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@cesc1989
cesc1989 / update-url.sql
Last active December 1, 2018 16:11
Consulta SQL para cambiar las urls por defecto de una instalación de WordPress cuando se mueve de servidor
UPDATE wp_options
SET option_value = 'http://yourdomain.com/'
WHERE option_name = 'siteurl';
UPDATE wp_options
SET option_value = 'http://yourdomain.com/'
WHERE option_name = 'home';
/* Más información:
https://otroespacioblog.wordpress.com/2014/12/10/la-solucion-definitiva-al-error-de-las-cookies-en-wordpress
@cesc1989
cesc1989 / Vagrantfile
Last active January 29, 2016 19:32
Provisioning Dev Stack. Provision a normal Linux machine or a Vagrant Ubuntu-based box.
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.network 'forwarded_port', guest: 3000, host: 3000
config.vm.provision 'shell', path: 'install_software.sh'