Skip to content

Instantly share code, notes, and snippets.

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

Gerardo Ortega g3ortega

🏠
Working from home
View GitHub Profile
@g3ortega
g3ortega / index.html
Created December 10, 2015 21:33
React Practica
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js">
</script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
</head>
<body>
</body>
@g3ortega
g3ortega / conf.sh
Created September 8, 2015 23:44
MySQL para Rails en Ubuntu
# En el proceso de instalación se pedirá un password, si es en producción recuerda escoger un password seguro. En un entorno de desarrollo se puede ser más fléxible.
$ sudo apt-get install mysql-server
$ sudo apt-get install mysql-client
# Para verificar si se instaló correctamente
$ sudo netstat -tap | grep mysql
# Para rails asegurate de instalar la siguiente dependencia
/* Based on
* - EGM Mathematical Finance class by Enrique Garcia M. <egarcia@egm.co>
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1)
*/
var ExcelFormulas = {
PVIF: function(rate, nper) {
return Math.pow(1 + rate, nper);
},
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
require 'fileutils'
desc "Create nondigest versions of all ckeditor digest assets"
task "assets:precompile" => :environment do
fingerprint = /\-([0-9a-f]{32})\./
for file in Dir["public/assets/ckeditor/**/*"]
# Skip file unless it has a fingerprint
next unless file =~ fingerprint
# Get filename of this file without the digest
@g3ortega
g3ortega / gist:a5a3e4b077dcc8a1d1e2
Created June 20, 2014 01:53
Get category by tax
function get_the_category_bytax( $id = false, $tcat = 'category' ) {
$categories = get_the_terms( $id, $tcat );
if ( ! $categories )
$categories = array();
$categories = array_values( $categories );
foreach ( array_keys( $categories ) as $key ) {
_make_cat_compat( $categories[$key] );
}
@g3ortega
g3ortega / gist:6abdff0f867c64f84107
Created May 28, 2014 01:33
Migrate git repo from bitbucket to github
cd $HOME/<dir>
git remote rename origin bitbucket
git remote add origin <url repo>
git push origin master
git remote rm bitbucket
#
# mmm m m mmm mmm mmm mmmmm mmm
# " # "m m m" #" # # " #" "# # # # #" #
# m"""# #m#m# #"""" """m # # # # # #""""
# "mm"# # # "#mm" "mmm" "#m#" # # # "#mm"
#
# nginx configuration For Ruby/Rack web applications
#
# Cooked up with style, care and a bit of *secret*
# nerdy spice. :-)

Sharing files using netcat

The receiver

nc -l 5566 > data-dump.sql

Listen on port 5566 and redirect output to data-dump.sql

The sender

@g3ortega
g3ortega / gist:8885136
Created February 8, 2014 15:09
Instalar ScreenCloud en Ubuntu
sudo su
echo 'deb http://download.opensuse.org/repositories/home:olav-st/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/screencloud.list
wget -O - http://download.opensuse.org/repositories/home:olav-st/xUbuntu_12.04/Release.key | apt-key add -
apt-get update
apt-get install screencloud