Skip to content

Instantly share code, notes, and snippets.

View cecyc's full-sized avatar
🙈

Cecy Correa cecyc

🙈
View GitHub Profile
@cecyc
cecyc / scrabble_scorer.rb
Created August 16, 2015 19:35
Scrabble Scorer
def score(str)
dictionary = { "A" => 1, "E" => 1, "I" => 1, "O" => 1, "U" => 1, "L" => 1,
"N" => 1, "R" => 1, "S" => 1, "T" => 1, "D" => 2, "G" => 2,
"B" => 3, "C" => 3, "M" => 3, "P" => 3, "F" => 4, "H" => 4,
"V" => 4, "W" => 4, "Y" => 4, "K" => 5, "J" => 8, "X" => 8,
"Q" => 10, "Z" => 10 }
split_string = str.upcase.split("")
sum = []
split_string.each do |i|
sum << dictionary[i]
@cecyc
cecyc / docker-compose.yml
Created September 16, 2016 19:54
Sample Docker Compose file for a simple WordPress setup
version: '2' #The Docker Compose file format version to be used
services:
database: #The name of the container, you can name this whatever you want.
image: mysql:latest #The image you are pulling into the container
environment:
MYSQL_ROOT_PASSWORD: tacos
MYSQL_DATABASE: tacos
MYSQL_USER: tacos
MYSQL_PASSWORD: tacos
@cecyc
cecyc / scp_cli.md
Last active May 15, 2017 15:04
Copying remote files via CLI

How to copy a file in a remote onto your local machine:

scp REMOTE:FILENAME ./

REMOTE: where the file is FILENAME: the file you want to copy ./ where the file will be copied to (do not have to name it as it will use the name of the file in the remote

You can run a SQL query and pipe into a file on a remote location, then use method above to copy locally.

@cecyc
cecyc / go_runes.go
Last active May 15, 2017 15:05
Print out runes in Golang (from Todd McLeod Golang training). Pretty neat for teaching unicode and special characters.
package main
import "fmt"
func main() {
for i := 0; i <= 500; i++ {
//Print the integer, the string of i (rune), and the bytes of i
fmt.Println(i, " - ", string(i), []byte(string(i)))
}
@cecyc
cecyc / adding_indexes_sql.md
Last active May 15, 2017 15:08
Adding indexes to MySQL

How to add indexes in MySQL

Basics:

alter table NAME add index <column>

The above works if you are adding an index to just one column. If you need to index different variations:

alter table NAME add index INDEXNAME(things,to,index)

@cecyc
cecyc / gem_gotchas.md
Last active May 15, 2017 15:09
Creating your own gem gotchas

Sometimes when you try to run your file, you may get an error because the file is not in your Ruby path. You can:

Run irb -I. to fix this but this is a pain. You could alias irb to irb -I....

You could also use bundle console to open irb with your gem code loaded (assuming that you _are_using bundler).

You could also...

  task :console do
 require 'irb'
@cecyc
cecyc / demystifying_webhooks.md
Last active May 15, 2017 15:10
Demystifying webhooks: A lot of devs don't know what webhooks are. Let's fix that.
@cecyc
cecyc / mongo_cheatsheet.md
Last active May 15, 2017 17:14
Mongo DB cheat sheet

MongoDB cheat sheet

For those of you learning Mongo and need a quick reference.

Show databases on the server

show dbs

Use a specific db on the server

@cecyc
cecyc / .vimrc
Created June 25, 2017 17:08
My very simple vimrc
colorscheme desert
syntax enable "enable language specific syntax
set tabstop=4 "tabs are 4 spaces
set number "show line numbers on the right
set showcmd "show command at bottom
set wildmenu "show autocomplete options
set showmatch "highlight corresponding [{()}]
set laststatus=2 "always show status bar
set splitbelow "set split to bottom
set splitright "set split to right hand side
@cecyc
cecyc / appending_in_go.go
Created October 12, 2017 19:04
How to append objects into a slice in Go
package main
import (
"fmt"
)
type Doggo struct {
Name string
Age int
}