Skip to content

Instantly share code, notes, and snippets.

View sergiotapia's full-sized avatar
💭
In my restless dreams, I see that town.

Yeyo sergiotapia

💭
In my restless dreams, I see that town.
View GitHub Profile
rails _3.2.13_ new smitecamp
bundle install
rails g scaffold champion name:string title:string hp:integer release_date:date

rake db:migrate

# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
encoding: unicode
host: localhost
database: smitecamp_db
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
@sergiotapia
sergiotapia / go-fizzbuzz.go
Last active December 30, 2015 20:59
FizzBuzz written using Golang!
package main
import "fmt"
func main() {
i := 1
for i <= 100 {
if (i % 3 == 0 && i % 5 == 0) {
fmt.Println("Fizzbuzz")
} else if (i % 3 == 0) {
@sergiotapia
sergiotapia / Munich-NO2.md
Created August 24, 2017 14:58
NO2 in Munich, 2016

NO2 in Munich 2016: high traffic => high NO2

2016-mu5-hours-junedec-23aug

This plot shows NO2 levels over the day in Munich in June and December 2016. München-Landshuter-Allee on the left has about the highest NO2 levels in all Germany, and a lot of traffic — 120,000 to 150,000 cars and light trucks per day.
Surprise: high traffic => high NO2.

@sergiotapia
sergiotapia / md5-example.go
Last active December 5, 2023 03:53
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@sergiotapia
sergiotapia / images_dimensions.go
Last active February 13, 2024 17:40
Golang - Getting the dimensions of an image. jpg, jpeg, png
package main
import (
"fmt"
"image"
"os"
_ "image/jpeg"
_ "image/png"
)