Skip to content

Instantly share code, notes, and snippets.

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

Boris Barroso boriscy

🏠
Working from home
  • Lead With Purpose
  • Samaipata, Bolivia
View GitHub Profile
<?php
/**
* Cliente REST para poder consumir el servicio WEB de MotoEx
* @author: Boris Barroso
* @license: GNU/GPL
*/
class RestMotoEx {
public $url, $format;
/**
<?php
/**
* Cliente REST para poder consumir el servicio WEB de MotoEx
* @author: Boris Barroso
* @license: GNU/GPL
*/
class RestMotoEx {
public $url, $format;
/**
rails test_simple_form
# The I edit the Gemfile to use simple_form
Gem "simple_form"
rails g simple_form_install
rails g scaffold user name:string
rails g scaffold post title:string post:text user:references
@boriscy
boriscy / google_calendar.rb
Created October 27, 2010 11:22
Retrive events from google calendar
require "rubygems"
require "gcal4ruby"
class Time
def self.parse_complete(value)
if value =~ /^[0-9]+T[0-9]+$/
d, h = value.split("T")
Time.parse(d+" "+h.gsub("Z", ""))
else
Time.parse(value + " 00:00:00")
@boriscy
boriscy / mysqltuner.pl
Created November 12, 2010 18:50
MySQL tunning script
#!/usr/bin/perl -w
# mysqltuner.pl - Version 1.1.0
# High Performance MySQL Tuning Script
# Copyright (C) 2006-2009 Major Hayden - major@mhtx.net
#
# For the latest updates, please visit http://mysqltuner.com/
# Subversion repository available at http://tools.assembla.com/svn/mysqltuner/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@boriscy
boriscy / rvm and gems in ubuntu
Created November 26, 2010 19:44
Ruby debug 19
sudo apt-get install curl git-core ruby
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
echo "[[ -s "$HOME/.rvm/scripts/rvm" ]] && source \"$HOME/.rvm/scripts/rvm\"" >> .bashrc
sudo aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim-gnome libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf
rvm install 1.9.2
cd ~/.rvm/src/ruby-1.9.2-p0/ext/readline
ruby extconf.rb
make
make install
@boriscy
boriscy / gist:730495
Created December 6, 2010 16:11
Ruby dsl
class Prueba
attr_reader :nombre, :apellido, :edad
def initialize(&b)
instance_eval &b
end
def method_missing(method, param)
method = method.to_s
if prueba_methods.include?(method)
@boriscy
boriscy / gist:739009
Created December 13, 2010 14:03
demo sql
-- phpMyAdmin SQL Dump
-- version 3.3.8
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 13, 2010 at 10:02 AM
-- Server version: 5.1.41
-- PHP Version: 5.3.2-1ubuntu4.5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@boriscy
boriscy / gist:827469
Created February 15, 2011 12:44
Gemfile example
source :rubygems
gem "rails", ">= 3.0"
gem "rack"
gem "clearance", "0.9.0.rc9"
gem "haml"
gem "high_voltage"
gem "hoptoad_notifier"
gem "RedCloth", :require => "redcloth"
gem "paperclip"
@boriscy
boriscy / metaprog.rb
Created May 3, 2011 20:49
Examples to not forget metaprogramming
# Some examples to not forget Ruby metaprogramming
class Uno
end
module ExtendMethods
def self.included(base)
base.send(:include, ClassMethods)
base.send(:extend, InstanceMethods)
end