Skip to content

Instantly share code, notes, and snippets.

View edolopez's full-sized avatar
🎯
Focusing

Eduardo Lopez De Leon edolopez

🎯
Focusing
View GitHub Profile
@edolopez
edolopez / Age.java
Last active December 26, 2015 08:08
Example Input/Output in Java
import java.io.*;
public class Age {
public static void main(String [] args) throws IOException {
InputStreamReader inStream = new InputStreamReader(System.in);
BufferedReader systemIn = new BufferedReader(inStream);
String my_name, greeting, myAge, variable;
@edolopez
edolopez / funciones.rb
Created October 18, 2013 13:20
A simple way to use functions (methods) in Ruby
# encoding: UTF-8
# Pide calificación mexicana y convierte a americana
def pregunta_usuario(variable)
puts "sigo en el bloque"
begin
# acciones al menos 1 vez
puts "Dame un valor entero para la calificación que quieres convertir"
calificacion = gets.to_i
@edolopez
edolopez / problem1_partial2.rb
Created October 11, 2013 17:13
CSC - Code snippet for printing the number of lines with asterisks.
#encoding: utf-8
# Problema 1 del Examen 2o. Parcial
# author: @edolopez
entero = 0
cont = 1
begin
puts "Eso no es correcto, intenta de nuevo!" if entero > 50
@edolopez
edolopez / gist:5453635
Created April 24, 2013 16:48
GNIP data received. Comparing good hash structure and bad hash structure
//Valid JSON format for tweet received
{
"id": "tag:search.twitter.com,2005:327100841452519425",
"objectType": "activity",
"actor": {
"objectType": "person",
"id": "id:twitter.com:114054810",
"link": "http://www.twitter.com/anuel_81",
"displayName": "luis enrique anuel",
"postedTime": "2010-02-13T23:51:24.000Z",
@edolopez
edolopez / branch_removal_bitbucket
Created January 29, 2013 19:15
Removing a remote branch on a Bitbucket Repo
git branch -rd TOREMOVE
git push origin :TOREMOVE
or
git branch -rd origin/TOREMOVE
@edolopez
edolopez / haml2erb.rb
Created December 18, 2012 19:07
Script that converts 'haml' to 'erb'. It also accepts utf-8 encoding.
Encoding.default_external = 'UTF-8'
Encoding.default_internal = 'UTF-8'
require 'haml'
class ErbEngine < Haml::Engine
def push_script(text, preserve_script, in_tag = false, preserve_tag = false,
escape_html = false, nuke_inner_whitespace = false)
push_text "<%= #{text.strip} %>"
end