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 / 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 / wp-config.php
Created October 11, 2017 17:30
Set WordPress site URL in the config file instead of the database
<?php
// WordPress stores the site URL in the database by default (which I have never
// understood), and it's a pain to have to type out the UPDATE SQL or search in
// phpMyAdmin to change it. This is a simple way to put the URL into
// wp-config.php instead.
// Note that you will still need to update any URLs that appear in the content,
// especially when you copy a database from a development site to production:
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5
@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 / 001_position_args.sh
Created October 11, 2017 17:58
Different ways for declaring a function's arguments in Bash scripts
#!/bin/bash -xe
function byPosition () {
echo "Variable in position 1: $1"
echo "Variable in position 2: $2"
}
byPosition hola mundo
@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 / 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 / update_multiple_rows.php
Last active December 1, 2018 16:13
conectarse a la base de datos y actualizar varias filas mediante ciclo for
<?php
//CONEXION A LA BASE DE DATOS
$username = "root";
$password = "root";
$hostname = "localhost";
$link = mysql_connect($hostname, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
@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 / multi-git.md
Last active March 20, 2019 22:04 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up a separate github and bitbucket account on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Save keys to:

~/.ssh/id_rsa

@cesc1989
cesc1989 / create-room.js
Created April 21, 2020 15:17
Ember Octane + Twilio Video
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import * as Video from 'twilio-video/dist/twilio-video';
import { attachTracks } from "../utils/intrati-twilio";
export default class CreateRoomComponent extends Component {